• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java YamlPropertySourceLoader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StringLoader类代码示例发布时间:2022-05-22
下一篇:
Java InsertManyOptions类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap