Update 36.2. Locating auto-configuration candidates.md
parent
99516241dd
commit
a0e8a047c9
|
@ -0,0 +1,9 @@
|
|||
### 36.2. 定位auto-configuration候选者
|
||||
|
||||
Spring Boot会检查你发布的jar中是否存在META-INF/spring.factories文件。该文件应该列出以EnableAutoConfiguration为key的配置类:
|
||||
```java
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.mycorp.libx.autoconfigure.LibXAutoConfiguration,\
|
||||
com.mycorp.libx.autoconfigure.LibXWebAutoConfiguration
|
||||
```
|
||||
如果配置需要应用特定的顺序,你可以使用[@AutoConfigureAfter](http://github.com/spring-projects/spring-boot/tree/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureAfter.java)或[@AutoConfigureBefore](http://github.com/spring-projects/spring-boot/tree/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureBefore.java)注解。例如,你想提供web-specific配置,你的类就需要应用在WebMvcAutoConfiguration后面。
|
Loading…
Reference in New Issue