本文整理汇总了Java中org.springframework.boot.env.YamlPropertySourceLoader类的典型用法代码示例。如果您正苦于以下问题:Java YamlPropertySourceLoader类的具体用法?Java YamlPropertySourceLoader怎么用?Java YamlPropertySourceLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
YamlPropertySourceLoader类属于org.springframework.boot.env包,在下文中一共展示了YamlPropertySourceLoader类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: yamlPropertySourceLoader
import org.springframework.boot.env.YamlPropertySourceLoader; //导入依赖的package包/类
/**
* Yaml property source loader.
*
* @return the property source
* @throws IOException Signals that an I/O exception has occurred.
*/
@Bean
public PropertySource<?> yamlPropertySourceLoader() throws IOException {
YamlPropertySourceLoader loader = new YamlPropertySourceLoader();
PropertySource<?> applicationYamlPropertySource = loader.load("application.yml",
new ClassPathResource("application.yml"), "default");
return applicationYamlPropertySource;
}
开发者ID:gersonmartins,项目名称:SimpleRedisCrud,代码行数:14,代码来源:ApplicationConfiguration.java
示例2: yamlPropertySourceLoader
import org.springframework.boot.env.YamlPropertySourceLoader; //导入依赖的package包/类
@Bean
public PropertySource<?> yamlPropertySourceLoader() throws IOException {
YamlPropertySourceLoader loader = new YamlPropertySourceLoader();
PropertySource<?> applicationYamlPropertySource = loader.load(
"application.yml", new ClassPathResource("application.yml"),"default");
return applicationYamlPropertySource;
}
开发者ID:szaqal,项目名称:KitchenSink,代码行数:8,代码来源:ApplicationConfig.java
示例3: consumerPropertySource
import org.springframework.boot.env.YamlPropertySourceLoader; //导入依赖的package包/类
@Bean
@Order(-1)
PropertySource consumerPropertySource() throws IOException {
YamlPropertySourceLoader loader = new YamlPropertySourceLoader();
PropertySource propertySource =
loader.load("consumers", new ClassPathResource("consumer.yml"),null);
env.getPropertySources().addLast(propertySource);
return propertySource;
}
开发者ID:eXcellme,项目名称:eds,代码行数:10,代码来源:EdsCamelConfig.java
示例4: initialize
import org.springframework.boot.env.YamlPropertySourceLoader; //导入依赖的package包/类
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
try {
Resource resource = applicationContext.getResource("classpath:application.yml");
YamlPropertySourceLoader sourceLoader = new YamlPropertySourceLoader();
PropertySource<?> yamlTestProperties = sourceLoader.load("yamlTestProperties", resource, null);
applicationContext.getEnvironment().getPropertySources().addLast(yamlTestProperties);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:spinnaker,项目名称:fiat,代码行数:12,代码来源:YamlFileApplicationContextInitializer.java
示例5: propertyParseIsEqualToYaml
import org.springframework.boot.env.YamlPropertySourceLoader; //导入依赖的package包/类
@Test
public void propertyParseIsEqualToYaml() throws Exception {
HoconPropertySourceLoader hoconLoader = new HoconPropertySourceLoader();
YamlPropertySourceLoader yamlLoader = new YamlPropertySourceLoader();
EnumerablePropertySource hoconParse = loadProperties(hoconLoader, "/application.conf");
EnumerablePropertySource yamlParse = loadProperties(yamlLoader, "/application.yaml");
verifyPropertyKeysAreSame(hoconParse, yamlParse);
verifyPropertyValuesAreSame(hoconParse, yamlParse);
}
开发者ID:zeldigas,项目名称:spring-hocon-property-source,代码行数:12,代码来源:HoconPropertySourceLoaderTest.java
示例6: initialize
import org.springframework.boot.env.YamlPropertySourceLoader; //导入依赖的package包/类
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
try {
Resource resource = applicationContext.getResource("classpath:/config/application.yml");
YamlPropertySourceLoader sourceLoader = new YamlPropertySourceLoader();
PropertySource<?> yamlTestProperties = sourceLoader.load("application.yml", resource, null);
applicationContext.getEnvironment().getPropertySources().addLast(yamlTestProperties);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:CiscoCTA,项目名称:taxii-log-adapter,代码行数:12,代码来源:YamlFileApplicationContextInitializer.java
示例7: loadPropertySource
import org.springframework.boot.env.YamlPropertySourceLoader; //导入依赖的package包/类
private PropertySource<?> loadPropertySource(Resource resource, String path) {
if (resource.exists()) {
try {
PropertySource<?> source = new YamlPropertySourceLoader().load(path,
resource, null);
if (source != null) {
logger.info("Loaded YAML properties from: " + resource);
}
return source;
}
catch (IOException e) {
}
}
return null;
}
开发者ID:spring-cloud,项目名称:spring-cloud-cli,代码行数:16,代码来源:Deployer.java
示例8: yamlPropertySourceLoader
import org.springframework.boot.env.YamlPropertySourceLoader; //导入依赖的package包/类
@Bean
public static YamlPropertySourceLoader yamlPropertySourceLoader() {
return new YamlPropertySourceLoader();
}
开发者ID:xiaojieliu7,项目名称:MicroServiceProject,代码行数:5,代码来源:GraphDatabaseConfiguration.java
示例9: loadYaml
import org.springframework.boot.env.YamlPropertySourceLoader; //导入依赖的package包/类
public static PropertySource<?> loadYaml(String classpath){
YamlPropertySourceLoader loader = new YamlPropertySourceLoader();
try {
PropertySource<?> props = loader.load(classpath, SpringUtils.newClassPathResource(classpath), null);
return props;
} catch (IOException e) {
throw new BaseException("load yaml file error: " + classpath);
}
}
开发者ID:wayshall,项目名称:onetwo,代码行数:10,代码来源:BootUtils.java
示例10: test
import org.springframework.boot.env.YamlPropertySourceLoader; //导入依赖的package包/类
@Test
public void test() throws Exception{
YamlPropertySourceLoader loader = new YamlPropertySourceLoader();
PropertySource<?> props = loader.load("application", SpringUtils.newClassPathResource("application.yaml"), null);
Object env = props.getProperty("spring.profiles.active");
System.out.println("env: " + env);
env = props.getProperty("server.port");
System.out.println("port: " + env);
}
开发者ID:wayshall,项目名称:onetwo,代码行数:10,代码来源:YamlPropertySourceLoaderTest.java
示例11: dispacherPropertySource
import org.springframework.boot.env.YamlPropertySourceLoader; //导入依赖的package包/类
@Bean
@Order(-1)
PropertySource dispacherPropertySource() throws IOException {
YamlPropertySourceLoader loader = new YamlPropertySourceLoader();
// profile null is default
PropertySource propertySource =
loader.load("dispachers", new ClassPathResource("dispatch.yml"),null);
env.getPropertySources().addLast(propertySource);
return propertySource;
}
开发者ID:eXcellme,项目名称:eds,代码行数:11,代码来源:EdsCamelConfig.java
注:本文中的org.springframework.boot.env.YamlPropertySourceLoader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论