From 2824f1d50b4a520e6b9162e7886b5a95adef5de3 Mon Sep 17 00:00:00 2001 From: qibaoguang Date: Fri, 20 Mar 2015 00:39:58 +0800 Subject: [PATCH] Update 16.2. Disabling specific auto-configuration.md --- .../16.2. Disabling specific auto-configuration.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/III. Using Spring Boot/16.2. Disabling specific auto-configuration.md b/III. Using Spring Boot/16.2. Disabling specific auto-configuration.md index e69de29..c52381d 100644 --- a/III. Using Spring Boot/16.2. Disabling specific auto-configuration.md +++ b/III. Using Spring Boot/16.2. Disabling specific auto-configuration.md @@ -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 { +} +```