From 5d69318e2d45f44f62fe2030d20ebba9cea4f665 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 15 Jun 2017 13:43:13 +0200 Subject: [PATCH] Add reference to SpringBootApplication in EnableAutoConfiguration Closes gh-9521 --- .../autoconfigure/EnableAutoConfiguration.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java index 95fcaa4cf4..bf2fcf7843 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java @@ -41,6 +41,9 @@ import org.springframework.core.io.support.SpringFactoriesLoader; * {@link TomcatEmbeddedServletContainerFactory} (unless you have defined your own * {@link EmbeddedServletContainerFactory} bean). *

+ * When using {@link SpringBootApplication}, the auto-configuration of the context is + * automatically enabled and adding this annotation has therefore no additional effect. + *

* Auto-configuration tries to be as intelligent as possible and will back-away as you * define more of your own configuration. You can always manually {@link #exclude()} any * configuration that you never want to apply (use {@link #excludeName()} if you don't @@ -48,11 +51,12 @@ import org.springframework.core.io.support.SpringFactoriesLoader; * {@code spring.autoconfigure.exclude} property. Auto-configuration is always applied * after user-defined beans have been registered. *

- * The package of the class that is annotated with {@code @EnableAutoConfiguration} has - * specific significance and is often used as a 'default'. For example, it will be used - * when scanning for {@code @Entity} classes. It is generally recommended that you place - * {@code @EnableAutoConfiguration} in a root package so that all sub-packages and classes - * can be searched. + * The package of the class that is annotated with {@code @EnableAutoConfiguration}, + * usually via {@code @SpringBootApplication}, has specific significance and is often used + * as a 'default'. For example, it will be used when scanning for {@code @Entity} classes. + * It is generally recommended that you place {@code @EnableAutoConfiguration} (if you're + * not using {@code @SpringBootApplication}) in a root package so that all sub-packages + * and classes can be searched. *

* Auto-configuration classes are regular Spring {@link Configuration} beans. They are * located using the {@link SpringFactoriesLoader} mechanism (keyed against this class). @@ -66,6 +70,7 @@ import org.springframework.core.io.support.SpringFactoriesLoader; * @see ConditionalOnMissingBean * @see ConditionalOnClass * @see AutoConfigureAfter + * @see SpringBootApplication */ @SuppressWarnings("deprecation") @Target(ElementType.TYPE)