本文整理汇总了Java中org.springframework.boot.context.properties.ConfigurationProperties.prefix方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationProperties.prefix方法的具体用法?Java ConfigurationProperties.prefix怎么用?Java ConfigurationProperties.prefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.boot.context.properties.ConfigurationProperties
的用法示例。
在下文中一共展示了ConfigurationProperties.prefix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractPrefix
import org.springframework.boot.context.properties.ConfigurationProperties; //导入方法依赖的package包/类
/**
* Extract configuration prefix from {@link ConfigurationProperties} annotation.
* @param context the application context
* @param beanFactoryMetaData the bean factory meta-data
* @param beanName the bean name
* @param bean the bean
* @return the prefix
*/
private String extractPrefix(ApplicationContext context,
ConfigurationBeanFactoryMetaData beanFactoryMetaData, String beanName,
Object bean) {
ConfigurationProperties annotation = context.findAnnotationOnBean(beanName,
ConfigurationProperties.class);
if (beanFactoryMetaData != null) {
ConfigurationProperties override = beanFactoryMetaData
.findFactoryAnnotation(beanName, ConfigurationProperties.class);
if (override != null) {
// The @Bean-level @ConfigurationProperties overrides the one at type
// level when binding. Arguably we should render them both, but this one
// might be the most relevant for a starting point.
annotation = override;
}
}
return (StringUtils.hasLength(annotation.value()) ? annotation.value()
: annotation.prefix());
}