@Target(value=TYPE) @Retention(value=RUNTIME) @Documented @Inherited @SpringBootConfiguration @EnableAutoConfiguration @ComponentScan(excludeFilters={@ComponentScan.Filter(type=CUSTOM,classes=TypeExcludeFilter.class),}) @ConfigurationPropertiesScan public @interface SpringBootApplication
configuration
class that declares one or more
@Bean
methods and also triggers auto-configuration
, component scanning
, and
configuration properties scanning
. This is a
convenience annotation that is equivalent to declaring @Configuration
,
@EnableAutoConfiguration
, @ComponentScan
, and
@ConfigurationPropertiesScan
.Modifier and Type | Optional Element and Description |
---|---|
Class<?>[] |
exclude
Exclude specific auto-configuration classes such that they will never be applied.
|
String[] |
excludeName
Exclude specific auto-configuration class names such that they will never be
applied.
|
boolean |
proxyBeanMethods
Specify whether
@Bean methods should get proxied in order to enforce
bean lifecycle behavior, e.g. |
Class<?>[] |
scanBasePackageClasses
Type-safe alternative to
scanBasePackages() for specifying the packages to
scan for annotated components. |
String[] |
scanBasePackages
Base packages to scan for annotated components.
|
@AliasFor(annotation=EnableAutoConfiguration.class) public abstract Class<?>[] exclude
@AliasFor(annotation=EnableAutoConfiguration.class) public abstract String[] excludeName
@AliasFor(annotation=org.springframework.context.annotation.ComponentScan.class, attribute="basePackages") public abstract String[] scanBasePackages
scanBasePackageClasses()
for a type-safe alternative to String-based package names.@AliasFor(annotation=org.springframework.context.annotation.ComponentScan.class, attribute="basePackageClasses") public abstract Class<?>[] scanBasePackageClasses
scanBasePackages()
for specifying the packages to
scan for annotated components. The package of each class specified will be scanned.
Consider creating a special no-op marker class or interface in each package that serves no purpose other than being referenced by this attribute.
@AliasFor(annotation=org.springframework.context.annotation.Configuration.class) public abstract boolean proxyBeanMethods
@Bean
methods should get proxied in order to enforce
bean lifecycle behavior, e.g. to return shared singleton bean instances even in
case of direct @Bean
method calls in user code. This feature requires
method interception, implemented through a runtime-generated CGLIB subclass which
comes with limitations such as the configuration class and its methods not being
allowed to declare final
.
The default is true
, allowing for 'inter-bean references' within the
configuration class as well as for external calls to this configuration's
@Bean
methods, e.g. from another configuration class. If this is not needed
since each of this particular configuration's @Bean
methods is
self-contained and designed as a plain factory method for container use, switch
this flag to false
in order to avoid CGLIB subclass processing.
Turning off bean method interception effectively processes @Bean
methods
individually like when declared on non-@Configuration
classes, a.k.a.
"@Bean Lite Mode" (see @Bean's javadoc
). It is therefore behaviorally
equivalent to removing the @Configuration
stereotype.
@Bean
methodsCopyright © 2019 Pivotal Software, Inc.. All rights reserved.