Skip to content

Commit 3131616

Browse files
protyaysnicoll
authored andcommitted
Encourage use of SpringBootApplication
See gh-19855
1 parent 8dc3e74 commit 3131616

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ Doing so enables debug logs for a selection of core loggers and logs a condition
397397

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

402402
[source,java,indent=0]
403403
----
@@ -406,12 +406,12 @@ If you find that specific auto-configuration classes that you do not want are be
406406
import org.springframework.context.annotation.*;
407407
408408
@Configuration
409-
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
409+
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
410410
public class MyConfiguration {
411411
}
412412
----
413413

414-
If the class is not on the classpath, you can use the `excludeName` attribute of the annotation and specify the fully qualified name instead.
414+
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.
415415
Finally, you can also control the list of auto-configuration classes to exclude by using the `spring.autoconfigure.exclude` property.
416416

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

0 commit comments

Comments
 (0)