parent
8dc3e74447
commit
3131616c5a
|
@ -397,7 +397,7 @@ Doing so enables debug logs for a selection of core loggers and logs a condition
|
|||
|
||||
[[using-boot-disabling-specific-auto-configuration]]
|
||||
=== 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]
|
||||
----
|
||||
|
@ -406,12 +406,12 @@ If you find that specific auto-configuration classes that you do not want are be
|
|||
import org.springframework.context.annotation.*;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
|
||||
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
|
||||
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 you choose to use `@EnableAutoConfiguration` rather than `@SpringBootApplication`, please note that it also has an `exclude` attribute that can be used. If the class is not on the classpath, you can use the `excludeName` attribute of the annotation and specify the fully qualified name instead.
|
||||
Finally, you can also control the list of auto-configuration classes to exclude by using the `spring.autoconfigure.exclude` property.
|
||||
|
||||
TIP: You can define exclusions both at the annotation level and by using the property.
|
||||
|
|
Loading…
Reference in New Issue