From 3131616c5a74c058ca0ac205126afb4c8956a496 Mon Sep 17 00:00:00 2001 From: protyay Date: Wed, 22 Jan 2020 22:39:52 +0530 Subject: [PATCH 1/2] Encourage use of SpringBootApplication See gh-19855 --- .../src/main/asciidoc/using-spring-boot.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc index d09547bcc9c..9fb2a3653a1 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc @@ -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. From 650e55c24200df696e326545a3740fbb5b07e14b Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 23 Jan 2020 09:49:59 +0100 Subject: [PATCH 2/2] Polish "Encourage use of SpringBootApplication" See gh-19855 --- .../src/main/asciidoc/using-spring-boot.adoc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc index 9fb2a3653a1..6b91824bc86 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc @@ -403,15 +403,14 @@ If you find that specific auto-configuration classes that you do not want are be ---- import org.springframework.boot.autoconfigure.*; import org.springframework.boot.autoconfigure.jdbc.*; - import org.springframework.context.annotation.*; - @Configuration @SpringBootApplication(exclude={DataSourceAutoConfiguration.class}) - public class MyConfiguration { + public class MyApplication { } ---- -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. +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 `spring.autoconfigure.exclude` property. TIP: You can define exclusions both at the annotation level and by using the property.