Skip to content

Commit c77d4c0

Browse files
committed
Merge branch '2.1.x' into 2.2.x
Closes gh-19872
2 parents 9c27921 + c816b00 commit c77d4c0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,21 +395,20 @@ Doing so enables debug logs for a selection of core loggers and logs a condition
395395

396396
[[using-boot-disabling-specific-auto-configuration]]
397397
=== Disabling Specific Auto-configuration Classes
398-
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:
398+
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:
399399

400400
[source,java,indent=0]
401401
----
402402
import org.springframework.boot.autoconfigure.*;
403403
import org.springframework.boot.autoconfigure.jdbc.*;
404-
import org.springframework.context.annotation.*;
405404
406-
@Configuration(proxyBeanMethods = false)
407-
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
408-
public class MyConfiguration {
405+
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
406+
public class MyApplication {
409407
}
410408
----
411409

412410
If the class is not on the classpath, you can use the `excludeName` attribute of the annotation and specify the fully qualified name instead.
411+
If you prefer to use `@EnableAutoConfiguration` rather than `@SpringBootApplication`, `exclude` and `excludeName` are also available.
413412
Finally, you can also control the list of auto-configuration classes to exclude by using the configprop:spring.autoconfigure.exclude[] property.
414413

415414
TIP: You can define exclusions both at the annotation level and by using the property.

0 commit comments

Comments
 (0)