当前位置: 首页>>代码示例>>Java>>正文


Java YamlPropertySourceLoader.load方法代码示例

本文整理汇总了Java中org.springframework.boot.env.YamlPropertySourceLoader.load方法的典型用法代码示例。如果您正苦于以下问题:Java YamlPropertySourceLoader.load方法的具体用法?Java YamlPropertySourceLoader.load怎么用?Java YamlPropertySourceLoader.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.boot.env.YamlPropertySourceLoader的用法示例。


在下文中一共展示了YamlPropertySourceLoader.load方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例6: 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

示例7: 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

示例8: 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.load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。