@Bean
public static YamlPropertiesFactoryBean yamlPropertiesFactoryBean() {
YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
yaml.setResources(new ClassPathResource("application.yml"));
return yaml;
}
java类org.springframework.beans.factory.config.YamlPropertiesFactoryBean的实例源码
JavaConfig.java 文件源码
项目:Spring-Security-Third-Edition
阅读 34
收藏 0
点赞 0
评论 0
JavaConfig.java 文件源码
项目:Spring-Security-Third-Edition
阅读 27
收藏 0
点赞 0
评论 0
@Bean
public static YamlPropertiesFactoryBean yamlPropertiesFactoryBean() {
YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
yaml.setResources(new ClassPathResource("application.yml"));
return yaml;
}
JavaConfig.java 文件源码
项目:Spring-Security-Third-Edition
阅读 26
收藏 0
点赞 0
评论 0
@Bean
public static YamlPropertiesFactoryBean yamlPropertiesFactoryBean() {
YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
yaml.setResources(new ClassPathResource("application.yml"));
return yaml;
}
BaseApplication.java 文件源码
项目:raptor
阅读 21
收藏 0
点赞 0
评论 0
@Bean
public static PropertySourcesPlaceholderConfigurer properties() {
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
propertySourcesPlaceholderConfigurer.setIgnoreResourceNotFound(false);
ArrayList<String> defaultSources = new ArrayList(Arrays.asList("raptor.yml", appName + ".yml"));
if (additionalConfigNames != null && !additionalConfigNames.isEmpty()) {
defaultSources.addAll(additionalConfigNames);
}
ArrayList<String> sources = new ArrayList(defaultSources);
if (developmentMode) {
defaultSources.forEach((source) -> {
sources.add(source.replace(".yml", ".dev.yml"));
});
}
try {
String envPath = System.getenv("CONFIG_BASEPATH");
if (envPath != null && envPath.isEmpty()) {
log.debug("Using CONFIG_BASEPATH={}", envPath);
basepath = envPath;
}
} catch (Exception e) {
log.warn("Failed to read environment variable CONFIG_BASEPATH: %s", e.getMessage());
}
log.debug("Configuration path {}", basepath);
List<Resource> resources = sources.stream()
.filter(f -> new File(basepath + f).exists())
.map(f -> new FileSystemResource(basepath + f))
.collect(Collectors.toList());
log.debug("Configuration sources: {}", resources.toString());
if (resources.isEmpty()) {
throw new RuntimeException("Cannot find a loadable property file in: " + basepath);
}
YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
yaml.setResources(resources.toArray(new Resource[]{}));
propertySourcesPlaceholderConfigurer.setProperties(yaml.getObject());
return propertySourcesPlaceholderConfigurer;
}
AccessTokenPrinter.java 文件源码
项目:sw360rest
阅读 26
收藏 0
点赞 0
评论 0
public static Properties getPropertiesFromApplicationYml() {
YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean();
yamlPropertiesFactoryBean.setResources(new ClassPathResource("application.yml"));
return yamlPropertiesFactoryBean.getObject();
}
AwsIntegrationTestStackRule.java 文件源码
项目:spring-cloud-stream-app-starters
阅读 28
收藏 0
点赞 0
评论 0
@Override
protected void before() throws Throwable {
try {
String awsCredentialsDir = System.getProperty("aws.credentials.path");
File awsCredentialsFile = new File(awsCredentialsDir, "aws.credentials.properties");
Properties awsCredentials = new Properties();
awsCredentials.load(new FileReader(awsCredentialsFile));
String accessKey = awsCredentials.getProperty("cloud.aws.credentials.accessKey");
String secretKey = awsCredentials.getProperty("cloud.aws.credentials.secretKey");
this.cloudFormation = new AmazonCloudFormationClient(new BasicAWSCredentials(accessKey, secretKey));
YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean();
yamlPropertiesFactoryBean.setResources(new ClassPathResource("application.yml"));
Properties applicationProperties = yamlPropertiesFactoryBean.getObject();
this.stackName = applicationProperties.getProperty("cloud.aws.stack.name");
after();
ClassPathResource stackTemplate = new ClassPathResource("AwsIntegrationTestTemplate.json");
String templateBody = FileCopyUtils.copyToString(new InputStreamReader(stackTemplate.getInputStream()));
this.cloudFormation.createStack(
new CreateStackRequest()
.withTemplateBody(templateBody)
.withOnFailure(OnFailure.DELETE)
.withStackName(this.stackName));
waitForCompletion();
System.setProperty("cloud.aws.credentials.accessKey", accessKey);
System.setProperty("cloud.aws.credentials.secretKey", secretKey);
}
catch (Exception e) {
if (!(e instanceof AssumptionViolatedException)) {
Assume.assumeTrue("Can't perform AWS integration test because of: " + e.getMessage(), false);
}
else {
throw e;
}
}
}
ArgumentResolver.java 文件源码
项目:egd-web
阅读 24
收藏 0
点赞 0
评论 0
public static Properties secretProperties(String profile) {
YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
yaml.setResources(new ClassPathResource("config/application-" + profile + "-secret.yml"));
yaml.afterPropertiesSet();
return yaml.getObject();
}
GerenciadorPermissoes.java 文件源码
项目:editor-de-servicos
阅读 28
收藏 0
点赞 0
评论 0
@Autowired
public GerenciadorPermissoes(YamlPropertiesFactoryBean properties) {
this.properties = properties;
}
GerenciadorPermissoesTest.java 文件源码
项目:editor-de-servicos
阅读 25
收藏 0
点赞 0
评论 0
private static YamlPropertiesFactoryBean loadProperty() {
YamlPropertiesFactoryBean permissoes = new YamlPropertiesFactoryBean();
permissoes.setResources(new ClassPathResource("permissoesTest.yaml"));
permissoes.afterPropertiesSet();
return permissoes;
}
Alien4CloudConfig.java 文件源码
项目:orchestrator
阅读 25
收藏 0
点赞 0
评论 0
@Bean(name = { "alienconfig", "elasticsearchConfig" })
public YamlPropertiesFactoryBean alienConfig(ResourceLoader resourceLoader) {
return AlienYamlPropertiesFactoryBeanFactory.get(resourceLoader);
}