Update 16.2. Disabling specific auto-configuration.md

master
qibaoguang 2015-03-20 00:39:58 +08:00
parent f79edc59f3
commit 2824f1d50b
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
### 16.2. 禁用特定的自动配置
如果发现应用了你不想要的特定自动配置类,你可以使用`@EnableAutoConfiguration`注解的排除属性来禁用它们。
```java
import org.springframework.boot.autoconfigure.*;
import org.springframework.boot.autoconfigure.jdbc.*;
import org.springframework.context.annotation.*;
@Configuration
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class MyConfiguration {
}
```