Java Code Examples for org.springframework.beans.factory.config.YamlPropertiesFactoryBean#afterPropertiesSet()
The following examples show how to use
org.springframework.beans.factory.config.YamlPropertiesFactoryBean#afterPropertiesSet() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertySources.java From super-cloudops with Apache License 2.0 | 5 votes |
@Override public Map<String, Object> resolve(String content) { YamlPropertiesFactoryBean ymlFb = new YamlPropertiesFactoryBean(); ymlFb.setResources(new ByteArrayResource(content.getBytes(Charsets.UTF_8))); ymlFb.afterPropertiesSet(); // Properties to map Map<String, Object> map = new HashMap<>(); if (ymlFb.getObject() != null) { ymlFb.getObject().forEach((k, v) -> map.put(String.valueOf(k), v)); } return map; }
Example 2
Source File: YamlPropertySourceFactory.java From prebid-server-java with Apache License 2.0 | 5 votes |
private Properties loadYamlIntoProperties(EncodedResource resource) throws FileNotFoundException { try { final YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean(); factory.setResources(resource.getResource()); factory.afterPropertiesSet(); return factory.getObject(); } catch (IllegalStateException e) { // for ignoreResourceNotFound final Throwable cause = e.getCause(); if (cause instanceof FileNotFoundException) { throw (FileNotFoundException) cause; } throw e; } }
Example 3
Source File: DefaultEnvironmentPostProcessor.java From spring-cloud-dashboard with Apache License 2.0 | 5 votes |
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)); } } }
Example 4
Source File: DefaultEnvironmentPostProcessor.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
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)); } } }
Example 5
Source File: YamlPropertySourceFactory.java From spring-cloud with Apache License 2.0 | 4 votes |
private Properties loadYamlIntoProperties(EncodedResource resource) { YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean(); factory.setResources(resource.getResource()); factory.afterPropertiesSet(); return factory.getObject(); }
Example 6
Source File: InitializrMetadataBuilderTests.java From initializr with Apache License 2.0 | 4 votes |
private static Properties loadProperties(Resource resource) { YamlPropertiesFactoryBean yamlFactory = new YamlPropertiesFactoryBean(); yamlFactory.setResources(resource); yamlFactory.afterPropertiesSet(); return yamlFactory.getObject(); }