반응형

개발 82

Swagger씨, API 문서 작성해주세요 !

이번 포스팅에선 API 문서를 자동화해주는 Swagger에 대해 알아볼 것이다.  API 문서는 왜 작성할까?단순 문서화개발 협업(프론트 개발자 - 백엔드 개발자)버전 관리테스트예전에 팀 프로젝트에서 모바일 개발자님에게 API 공유를 위해 API 명세서를 일일이 노션으로 작성한 적이 있다.당시 문서화하면서 머리가 나쁘면 몸이 고생한다는 그 말이 생각났다.하지만 당시에는 아는 게 없으니 별 다른 수가 없어서 그냥 했었다. 멤버 등록 API를 문서화해 보자build.gradle/* Swagger */implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0' application.ymlspringdoc:  api-docs:    enabl..

개발/스프링 2025.03.06

P6Spy를 도입하여 쿼리 로깅을 개선해보자

의존성 주입build.gradle/* p6spy */implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.0'스프링 3.x.x 이상은 1.9.0 이상 버전을 사용해야 한다.  2025-03-06T00:08:48.284+09:00  INFO 8720 --- [nio-8080-exec-6] p6spy                                    : #1741187328284 | took 0ms | statement | connection 19| url jdbc:oracle:thin:@localhost:1521:xeselect m1_0.member_email,m1_0.member_name,m1_0.member_descr..

개발/스프링 2025.03.06

[LeetCode] 83. Remove Duplicates from Sorted List #Easy #Java

문제Given the head of a sorted linked list, delete all duplicates such that each element appears only once. Return the linked list sorted as well.예제 1Input: head = [1,1,2]Output: [1,2]예제 2Input: head = [1,1,2,3,3]Output: [1,2,3]제약조건✅ The number of nodes in the list is in the range [0, 300].✅ -100 ✅ The list is guaranteed to be sorted in ascending order. 문제풀이/** * Definition for singly-linked list...

[LeetCode] 69. Sqrt(x) #Easy #Java

문제Given a non-negative integer x, return the square root of x rounded down to the nearest integer. The returned integer should be non-negative as well. You must not use any built-in exponent function or operator. For example, do not use pow(x, 0.5) in c++ or x ** 0.5 in python.예제 1 Input: x = 4Output: 2// Explanation: The square root of 4 is 2, so we return 2. 예제 2Input: x = 8Output: 2// Explana..

[LeetCode] 67. Add Binary #Easy #Java

문제Given two binary strings a and b, return their sum as a binary string.예제 1Input: a = "11", b = "1"Output: "100"예제 2Input: a = "1010", b = "1011"Output: "10101"제약조건✅ 1 ✅ a and b consist only of '0' or '1' characters. ✅ Each string does not contain leading zeros except for the zero itself. 문제풀이 1import java.math.BigInteger;class Solution {    public String addBinary(String a, String b) {        ..

[LeetCode] 58. Length of Last Word #Easy #Java

문제Given a string s consisting of words and spaces, return the length of the last word in the string.A word is a maximal substring consisting of non-space characters only.예제 1Input: s = "Hello World"Output: 5Explanation: The last word is "World" with length 5.예제 2Input: s = " fly me to the moon "Output: 4Explanation: The last word is "moon" with length 4.예제 3Input: s = "luffy is still joyb..

[LeetCode] 35. Search Insert Position #Easy #Java

문제Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You must write an algorithm with O(log n) runtime complexity.예제1Input: nums = [1,3,5,6], target = 5Output: 2예제2Input: nums = [1,3,5,6], target = 2Output: 1예제3Input: nums = [1,3,5,6], target = 7Output: 4제약조건✅ 1 ✅ -104 ✅ ..

[LeetCode] 28. Find the Index of the First Occurrence in a String #Easy #Java

문제Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.예제 1Input: haystack = "sadbutsad", needle = "sad"Output: 0// Explanation: "sad" occurs at index 0 and 6.// The first occurrence is at index 0, so we return 0.예제 2 Input: haystack = "leetcode", needle = "leeto"Output: -1// Explanation: "leeto" did not oc..