本文整理汇总了Java中org.springframework.beans.factory.config.YamlPropertiesFactoryBean.afterPropertiesSet方法的典型用法代码示例。如果您正苦于以下问题:Java YamlPropertiesFactoryBean.afterPropertiesSet方法的具体用法?Java YamlPropertiesFactoryBean.afterPropertiesSet怎么用?Java YamlPropertiesFactoryBean.afterPropertiesSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.factory.config.YamlPropertiesFactoryBean
的用法示例。
在下文中一共展示了YamlPropertiesFactoryBean.afterPropertiesSet方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadYamlProperties
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; //导入方法依赖的package包/类
private static Map<Object, Object> loadYamlProperties(final Resource... resource) {
final YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResolutionMethod(YamlProcessor.ResolutionMethod.OVERRIDE);
factory.setResources(resource);
factory.setSingleton(true);
factory.afterPropertiesSet();
return factory.getObject();
}
示例2: contributeDefaults
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; //导入方法依赖的package包/类
private static void contributeDefaults(Map<String, Object> defaults, Resource resource) {
if (resource.exists()) {
YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean();
yamlPropertiesFactoryBean.setResources(resource);
yamlPropertiesFactoryBean.afterPropertiesSet();
Properties p = yamlPropertiesFactoryBean.getObject();
for (Object k : p.keySet()) {
String key = k.toString();
defaults.put(key, p.get(key));
}
}
}
示例3: getDeploymentProperties
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; //导入方法依赖的package包/类
protected Map<String, String> getDeploymentProperties(@CliOption(key = {
PROPERTIES_OPTION }, help = "the properties for this deployment") String deploymentProperties,
@CliOption(key = {
PROPERTIES_FILE_OPTION }, help = "the properties for this deployment (as a File)") File propertiesFile,
int which) throws IOException {
Map<String, String> propertiesToUse;
switch (which) {
case 0:
propertiesToUse = DeploymentPropertiesUtils.parse(deploymentProperties);
break;
case 1:
String extension = FilenameUtils.getExtension(propertiesFile.getName());
Properties props = null;
if (extension.equals("yaml") || extension.equals("yml")) {
YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean();
yamlPropertiesFactoryBean.setResources(new FileSystemResource(propertiesFile));
yamlPropertiesFactoryBean.afterPropertiesSet();
props = yamlPropertiesFactoryBean.getObject();
}
else {
props = new Properties();
try (FileInputStream fis = new FileInputStream(propertiesFile)) {
props.load(fis);
}
}
propertiesToUse = DeploymentPropertiesUtils.convert(props);
break;
case -1: // Neither option specified
propertiesToUse = new HashMap<>(1);
break;
default:
throw new AssertionError();
}
return propertiesToUse;
}
示例4: yamlPropertiesFactoryBean
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; //导入方法依赖的package包/类
@Bean
public YamlPropertiesFactoryBean yamlPropertiesFactoryBean() throws IOException {
YamlPropertiesFactoryBean permissoes = new YamlPropertiesFactoryBean();
permissoes.setResources(new ClassPathResource("permissoes.yaml"));
permissoes.afterPropertiesSet();
return permissoes;
}
示例5: secretProperties
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; //导入方法依赖的package包/类
public static Properties secretProperties(String profile) {
YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
yaml.setResources(new ClassPathResource("config/application-" + profile + "-secret.yml"));
yaml.afterPropertiesSet();
return yaml.getObject();
}
示例6: loadProperty
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; //导入方法依赖的package包/类
private static YamlPropertiesFactoryBean loadProperty() {
YamlPropertiesFactoryBean permissoes = new YamlPropertiesFactoryBean();
permissoes.setResources(new ClassPathResource("permissoesTest.yaml"));
permissoes.afterPropertiesSet();
return permissoes;
}
示例7: loadProperties
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; //导入方法依赖的package包/类
private static Properties loadProperties(Resource resource) {
YamlPropertiesFactoryBean yamlFactory = new YamlPropertiesFactoryBean();
yamlFactory.setResources(resource);
yamlFactory.afterPropertiesSet();
return yamlFactory.getObject();
}