spring_reference/IV. Spring Boot features/35.4.1. ConfigFileApplicati...

9 lines
435 B
Markdown
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

### 35.4.1. ConfigFileApplicationContextInitializer
ConfigFileApplicationContextInitializer是一个ApplicationContextInitializer可以用来测试加载Spring Boot的application.properties文件。当不需要使用@SpringApplicationConfiguration提供的全部特性时你可以使用它。
```java
@ContextConfiguration(classes = Config.class,initializers = ConfigFileApplicationContextInitializer.class)
```