Commit c77d4c07 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge branch '2.1.x' into 2.2.x

Closes gh-19872
parents 9c27921a c816b00a
...@@ -395,21 +395,20 @@ Doing so enables debug logs for a selection of core loggers and logs a condition ...@@ -395,21 +395,20 @@ Doing so enables debug logs for a selection of core loggers and logs a condition
[[using-boot-disabling-specific-auto-configuration]] [[using-boot-disabling-specific-auto-configuration]]
=== Disabling Specific Auto-configuration Classes === Disabling Specific Auto-configuration Classes
If you find that specific auto-configuration classes that you do not want are being applied, you can use the exclude attribute of `@EnableAutoConfiguration` to disable them, as shown in the following example: If you find that specific auto-configuration classes that you do not want are being applied, you can use the exclude attribute of `@SpringBootApplication` to disable them, as shown in the following example:
[source,java,indent=0] [source,java,indent=0]
---- ----
import org.springframework.boot.autoconfigure.*; import org.springframework.boot.autoconfigure.*;
import org.springframework.boot.autoconfigure.jdbc.*; import org.springframework.boot.autoconfigure.jdbc.*;
import org.springframework.context.annotation.*;
@Configuration(proxyBeanMethods = false) @SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) public class MyApplication {
public class MyConfiguration {
} }
---- ----
If the class is not on the classpath, you can use the `excludeName` attribute of the annotation and specify the fully qualified name instead. If the class is not on the classpath, you can use the `excludeName` attribute of the annotation and specify the fully qualified name instead.
If you prefer to use `@EnableAutoConfiguration` rather than `@SpringBootApplication`, `exclude` and `excludeName` are also available.
Finally, you can also control the list of auto-configuration classes to exclude by using the configprop:spring.autoconfigure.exclude[] property. Finally, you can also control the list of auto-configuration classes to exclude by using the configprop:spring.autoconfigure.exclude[] property.
TIP: You can define exclusions both at the annotation level and by using the property. TIP: You can define exclusions both at the annotation level and by using the property.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment