Springboot 어노테이션

min·2022년 3월 29일
0

참고
https://reiphiel.tistory.com/entry/junit5-features2
http://honeymon.io/tech/2018/10/22/spring-boot2-junit5.html
https://javacan.tistory.com/entry/springboot-configuration-properties-class
https://kkambi.tistory.com/104

@Transactional: 테스트 메서드가 종료 될 때 생성됬던 DB 데이터들을 Rollback
주의사항: https://javabom.tistory.com/103
한번 다시 읽어볼 필요가 있음

@ExtendWith(SpringExtension.class): JUnit5에서 반복적으로 실행되는 클래스나 메서드를 선언. SpringExtension.class는 스프링5에 추가 된 Junit5의 Jupiter 모델에서 스프링 테스트 컨텍스를 사용 할 수 있도록 도와줌.
@ConfigurationProperties(prefix = "app"): properties 파일에 정의된 프로퍼티들 중 주어진 prefix를 가진 프로퍼티를 매핑하여 Bean으로 사용 할 수 있게 해줌.
@EnableConfigurationProperties(value = AppProperties.class): properties를 사용 할 프로퍼티스 명시.
@TestPropertySource("classpath:application-oauth.properties"): 테스트만을 위한 프로퍼티 정의 방법
@Value("${spring.jwt.secret}": properties에 정의한 프로퍼티에 대한 값을 가져 올 수 있는 어노테이션. spring.jwt.secret의 값을 가져 올 수 있음.

lombok 어노테이션

@RequiredArgsConstructor: 생성자 주입을 임의의 코드 없이 자동으로 설정해줌. final이 붙거나 @NotNull이 붙은 필드의 생성자를 자동으로 생성함.
@NoArgsConstructor: 파라미터가 없는 기본 생성자 생성
@AllArgsConstructor: 모든 필드를 파라미터로 받는 생성자 생성
@Builder: 빌터 패턴을 사용 할 수 있게 해줌 (추가: https://velog.io/@minchoi/%EC%9E%90%EB%B0%94-%EB%B9%8C%EB%8D%94Builder-%ED%8C%A8%ED%84%B4)

너무 어렵다....🤢

profile
발등에 불이 따뜻하다..

0개의 댓글