Skip to content

Commit 5d69318

Browse files
committed
Add reference to SpringBootApplication in EnableAutoConfiguration
Closes gh-9521
1 parent 5538fba commit 5d69318

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,22 @@
4141
* {@link TomcatEmbeddedServletContainerFactory} (unless you have defined your own
4242
* {@link EmbeddedServletContainerFactory} bean).
4343
* <p>
44+
* When using {@link SpringBootApplication}, the auto-configuration of the context is
45+
* automatically enabled and adding this annotation has therefore no additional effect.
46+
* <p>
4447
* Auto-configuration tries to be as intelligent as possible and will back-away as you
4548
* define more of your own configuration. You can always manually {@link #exclude()} any
4649
* configuration that you never want to apply (use {@link #excludeName()} if you don't
4750
* have access to them). You can also exclude them via the
4851
* {@code spring.autoconfigure.exclude} property. Auto-configuration is always applied
4952
* after user-defined beans have been registered.
5053
* <p>
51-
* The package of the class that is annotated with {@code @EnableAutoConfiguration} has
52-
* specific significance and is often used as a 'default'. For example, it will be used
53-
* when scanning for {@code @Entity} classes. It is generally recommended that you place
54-
* {@code @EnableAutoConfiguration} in a root package so that all sub-packages and classes
55-
* can be searched.
54+
* The package of the class that is annotated with {@code @EnableAutoConfiguration},
55+
* usually via {@code @SpringBootApplication}, has specific significance and is often used
56+
* as a 'default'. For example, it will be used when scanning for {@code @Entity} classes.
57+
* It is generally recommended that you place {@code @EnableAutoConfiguration} (if you're
58+
* not using {@code @SpringBootApplication}) in a root package so that all sub-packages
59+
* and classes can be searched.
5660
* <p>
5761
* Auto-configuration classes are regular Spring {@link Configuration} beans. They are
5862
* located using the {@link SpringFactoriesLoader} mechanism (keyed against this class).
@@ -66,6 +70,7 @@
6670
* @see ConditionalOnMissingBean
6771
* @see ConditionalOnClass
6872
* @see AutoConfigureAfter
73+
* @see SpringBootApplication
6974
*/
7075
@SuppressWarnings("deprecation")
7176
@Target(ElementType.TYPE)

0 commit comments

Comments
 (0)