Loading...
Spring Framework Reference Documentation 7.0.2의 @TestPropertySource의 한국어 번역본입니다.
아래의 경우에 피드백에서 신고해주신다면 반영하겠습니다.
감사합니다 :)
@TestPropertySource@TestPropertySource는 integration test를 위해 로드된 ApplicationContext의 Environment에 있는 PropertySources 집합에 추가할 properties files의 locations와 inlined properties를 구성하기 위해 test class에 적용할 수 있는 어노테이션입니다.
다음 예제는 classpath에서 properties file을 선언하는 방법을 보여 줍니다:
1@ContextConfiguration 2@TestPropertySource("/test.properties") // (1) 3class MyIntegrationTests { 4 // class body... 5}
| 1 | classpath의 root에 있는 test.properties에서 properties를 가져옵니다. |
1@ContextConfiguration 2@TestPropertySource("/test.properties") // (1) 3class MyIntegrationTests { 4 // class body... 5}
| 1 | classpath의 root에 있는 test.properties에서 properties를 가져옵니다. |
다음 예제는 inlined properties를 선언하는 방법을 보여 줍니다:
1@ContextConfiguration 2@TestPropertySource(properties = { "timezone = GMT", "port: 4242" }) // (1) 3class MyIntegrationTests { 4 // class body... 5}
| 1 | timezone와 port properties를 선언합니다. |
1@ContextConfiguration 2@TestPropertySource(properties = ["timezone = GMT", "port: 4242"]) // (1) 3class MyIntegrationTests { 4 // class body... 5}
| 1 | timezone와 port properties를 선언합니다. |
예제와 추가 세부 정보는 Context Configuration with Test Property Sources를 참고하십시오.
@ActiveProfiles
@DynamicPropertySource