![[Java] @NoArgsConstructor(access = AccessLevel.PROTECTED)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FEB68d%2FbtsM4eqe1yy%2FEQNkS2tqllakkI5iCZ3y7k%2Fimg.jpg)
@NoArgsConstructor(access = PROTECTED)는 Lombok에서 제공하는 애노테이션으로, 기본 생성자(매개변수가 없는 생성자)를 접근 제어자 protected로 생성해주는 기능을 한다.핵심 의미@NoArgsConstructor(access = AccessLevel.PROTECTED)이 코드는 다음과 같은 생성자를 자동 생성한다. protected 클래스이름() {}즉, 생성자 메서드를 일일이 작성하지 않아도 되고, 접근 제어자까지 명확하게 설정 가능하다. 사용 목적JPA 엔티티용 기본 생성자JPA는 엔티티 객체를 만들 때 기본 생성자가 필요하다.하지만 외부에서 마음대로 new로 객체를 생성하는 건 막고 싶을 때 protected를 쓴다.@Entity@NoArgsConstructor..
주요 메서드 정리JUnit 주요 메서드 (org.junit.jupiter.api.Assertions) 메서드 설명 예시 assertEquals(expected, actual) 값이 같은지 비교 assertEquals(10, sum) assertNotEquals(expected, actual) 값이 다르면 통과 assertNotEquals(0, result) assertTrue(condition) 조건이 true면 통과 assertTrue(value > 0) assertFalse(condition) 조건이 f..
@Test의미: 이 메서드는 테스트 메서드임을 명시한다.위치: 테스트 메서드 위@Testvoid 회원가입_성공() { // given // when // then} @BeforeEach의미: 각 테스트 메서드 실행 직전마다 실행된다.주 용도: 공통 초기화, 테스트 상태 정리@BeforeEachpublic void beforeEach() { memberRepository = new MemoryMemberRepository(); memberService = new MemberService(memberRepository); } @AfterEach의미: 각 테스트 메서드 실행 직후마다 실행된다.주 용도: 리소스 정리, 로그 기록 등@AfterEachpublic void afterEac..
![[java] 백준 1167번 문제(트리의 지름)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F6bnMq%2FbtsM14nCVE9%2FebRQKbjkLpzTVFfGtzpSUk%2Fimg.png)
원본 링크 : https://www.acmicpc.net/problem/1167문제설명 소스코드import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.ArrayList;import java.util.StringTokenizer;public class Boj_1167{ static class Node { int number; // 정점 번호 int distance; // 거리 Node(int number, int distance) { this.number = number; ..
![[java] 백준 2178번 문제(미로 탐색)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FrZsIa%2FbtsM14AGYJM%2F0KKlIcFGGA6O9yd4xNYB41%2Fimg.png)
원본 링크 : https://www.acmicpc.net/problem/2178문제설명 소스코드import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.LinkedList;import java.util.Queue;import java.util.StringTokenizer;public class Boj_2178{ static int[][] arr; // 미로 static boolean[][] visited; // 방문 체크 static int n; static int m; public static void main(String[] args) th..
![[Spring] Spring Boot + Swagger](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FAVgW8%2FbtsM0pk8piI%2FjGOeFXYhHRz235viW4L4xK%2Fimg.png)
GitHub 저장소: https://github.com/springdoc/springdoc-openapi최신 릴리즈: https://github.com/springdoc/springdoc-openapi/releasesMaven Central: https://search.maven.org/search?q=g:org.springdoc SwaggerSwagger는 RESTful API를 설계, 문서화, 테스트할 수 있도록 도와주는 오픈소스 툴 세트이다.현재는 OpenAPI Specification(OAS)이라는 이름으로 공식적으로 관리되며, 그 구현체 중 하나가 Swagger이다.Swagger는 API의 명세(Specification)를 기계가 읽을 수 있는 형식(JSON 또는 YAML)으로 작성하고,이를 바..
![[java] 백준 13023번 문제(ABCDE)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F46bvk%2FbtsMW7yC2ql%2FpJdwqx15n4aVBROiDwaOL1%2Fimg.png)
원본 링크 : https://www.acmicpc.net/problem/13023문제설명 소스코드import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.ArrayList;import java.util.StringTokenizer;public class Boj_13023{ static boolean[] visited; // 방문 배열 static ArrayList[] adjacencyList; // 인접 리스트 public static void main(String[] args) throws IOException { BufferedRea..
![[Spring] Parameter 0 of constructor in xxx required a bean of type 'xxx' that could not be found.](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbcQEph%2FbtsMYqQ4TLu%2FXhdPvK2Iwa6h6IKUTkfGu1%2Fimg.png)
문제 상황1년전에 만들고 쳐다도 안본 프로젝트를 리팩토링하려고 베이스 패키지를 수정하다가 Parameter 0 of constructor in com.seungwook.r2r.service.IngredientService required a bean of type 'com.seungwook.r2r.repository.IngredientRepository' that could not be found. 이 오류를 만나게 되었다.기존 패키지 구조는 com.receipt2recipe 에서 com.seungwook.r2r로 바꾸었더니 "IngredientService는 IngredientRepository가 필요한데 못찾겠다." 라고 오류를 뿜고있었고, IngredientRepository는 분명히 존재하고 패키..