public final class ConfigurationPropertiesBean extends Object
@ConfigurationProperties
bean
details, regardless of if the annotation was used directly or on a @Bean
factory method. This class can be used to access all
configuration properties beans in an ApplicationContext, or
individual beans
on a case-by-case
basis (for example, in a BeanPostProcessor
).getAll(ApplicationContext)
,
get(ApplicationContext, Object, String)
Modifier and Type | Class and Description |
---|---|
static class |
ConfigurationPropertiesBean.BindMethod
The binding method that is used for the bean.
|
Modifier and Type | Method and Description |
---|---|
Bindable<?> |
asBindTarget()
|
static ConfigurationPropertiesBean |
get(ApplicationContext applicationContext,
Object bean,
String beanName)
Return a
@ConfigurationPropertiesBean instance
for the given bean details or null if the bean is not a
@ConfigurationProperties object. |
static Map<String,ConfigurationPropertiesBean> |
getAll(ApplicationContext applicationContext)
Return all
@ConfigurationProperties beans contained
in the given application context. |
ConfigurationProperties |
getAnnotation()
Return the
ConfigurationProperties annotation for the bean. |
ConfigurationPropertiesBean.BindMethod |
getBindMethod()
Return the property binding method that was used for the bean.
|
Object |
getInstance()
Return the actual Spring bean instance.
|
String |
getName()
Return the name of the Spring bean.
|
public String getName()
public Object getInstance()
public ConfigurationPropertiesBean.BindMethod getBindMethod()
public ConfigurationProperties getAnnotation()
ConfigurationProperties
annotation for the bean. The annotation
may be defined on the bean itself or from the factory method that create the bean
(usually a @Bean
method).public static Map<String,ConfigurationPropertiesBean> getAll(ApplicationContext applicationContext)
@ConfigurationProperties
beans contained
in the given application context. Both directly annotated beans, as well as beans
that have @ConfigurationProperties
annotated
factory methods are included.applicationContext
- the source application contextpublic static ConfigurationPropertiesBean get(ApplicationContext applicationContext, Object bean, String beanName)
@ConfigurationPropertiesBean
instance
for the given bean details or null
if the bean is not a
@ConfigurationProperties
object. Annotations are
considered both on the bean itself, as well as any factory method (for example a
@Bean
method).applicationContext
- the source application contextbean
- the bean to considerbeanName
- the bean namenull
if the neither the bean or
factory method are annotated with
@ConfigurationProperties