批注接口 ConfigurationPropertiesScan
@Target(TYPE)
@Retention(RUNTIME)
@Documented
@Import(org.springframework.boot.context.properties.ConfigurationPropertiesScanRegistrar.class)
@EnableConfigurationProperties
public @interface ConfigurationPropertiesScan
Configures the base packages used when scanning for
@ConfigurationProperties
classes. One of
basePackageClasses()
, basePackages()
or its alias value()
may be specified to define specific packages to scan. If specific packages are not
defined scanning will occur from the package of the class with this annotation.
Note: Classes annotated or meta-annotated with @Component
will not be
picked up by this annotation.
- 从以下版本开始:
- 2.2.0
- 作者:
- Madhura Bhave
-
可选元素概要
可选元素修饰符和类型可选元素说明Class<?>[]
Type-safe alternative tobasePackages()
for specifying the packages to scan for configuration properties.String[]
Base packages to scan for configuration properties.String[]
Alias for thebasePackages()
attribute.
-
元素详细资料
-
value
Alias for thebasePackages()
attribute. Allows for more concise annotation declarations e.g.:@ConfigurationPropertiesScan("org.my.pkg")
instead of@ConfigurationPropertiesScan(basePackages="org.my.pkg")
.- 返回:
- the base packages to scan
- 默认值:
{}
-
basePackages
Base packages to scan for configuration properties.value()
is an alias for (and mutually exclusive with) this attribute.Use
basePackageClasses()
for a type-safe alternative to String-based package names.- 返回:
- the base packages to scan
- 默认值:
{}
-
basePackageClasses
Class<?>[] basePackageClassesType-safe alternative tobasePackages()
for specifying the packages to scan for configuration properties. 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.
- 返回:
- classes from the base packages to scan
- 默认值:
{}
-