스프링부트테스트3 스프링부트 테스트(3) - context caching context caching 이란?테스트 시 구성되는 ApplicationContext 는 아래의 구성정보를 바탕으로 캐시 키를 발급한다.해당 캐시 키를 바탕으로 application context 를 구성하거나 재사용하게 되어서, 테스트시 이러한 구성정보가 다르다면 새로운 컨텍스트가 생성된다.locations (from @ContextConfiguration)classes (from @ContextConfiguration)contextInitializerClasses (from @ContextConfiguration)contextCustomizers (from ContextCustomizerFactory) – this includes @DynamicPropertySource methods as well.. 2024. 7. 23. 스프링부트 테스트(2) - configuration 과 property 1. 무엇으로 configuration 을 구성할까?참고로 조금 더 자세한 추가적인 내용은 공식문서에 있습니다.1편에서 소개한 TestContextBootstrapper 구현체 SpringBootTestContextBootstrapper 는 기본적으로 별다른 조건이 없다면 @SpringBootConfiguration 어노테이션이 붙은 클래스를 찾아서 context 를 구성한다.즉 @SpringBootApplication 어노테이션 내에 @SpringBootConfiguration 어노테이션을 포함하기 때문에 별다른 조건이 없는 경우 전체 컨테이너 환경이 구성되는 것이다.// @SpringBootApplication 어노테이션@Target(ElementType.TYPE)@Retention(Retention.. 2024. 7. 23. 스프링부트 테스트(1) - 동작원리와 어노테이션 친해지기 동작 원리TestContext 를 bootstrap 하는 원리테스트 컨텍스트란, 테스트시 application context 를 말하며 애플리케이션의 구성 정보를 구성하는 것을 말한다. 예를들어,애플리케이션의 Bean 을 로드하는 것도 이에 포함된다고 할 수 있다.그렇다면, 이 테스트 컨텍스트는 어떻게 로드 될까? 이를 알기 위해서 @SpringBootTest 어노테이션을 확인해보자.@Target(ElementType.TYPE)@Retention(RetentionPolicy.RUNTIME)@Documented@Inherited// TestContextBootstrapper 구현체 : SpringBootTestContextBootstrapper@BootstrapWith(SpringBootTestContex.. 2024. 7. 23. 이전 1 다음