- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.springframework.boot.env.YamlPropertySourceLoader.load()
方法的一些代码示例,展示了YamlPropertySourceLoader.load()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlPropertySourceLoader.load()
方法的具体详情如下:
包路径:org.springframework.boot.env.YamlPropertySourceLoader
类名称:YamlPropertySourceLoader
方法名:load
暂无
代码示例来源:origin: okta/okta-spring-boot
private PropertySource<?> loadYaml(Resource resource, boolean required) {
YamlPropertySourceLoader loader = new YamlPropertySourceLoader();
if (!resource.exists() && required) {
throw new IllegalArgumentException("Resource " + resource + " does not exist");
}
if (resource.exists()) {
try {
List<PropertySource<?>> list = loader.load(resource.getFilename(), resource);
return list.get(0);
} catch (IOException ex) {
throw new IllegalStateException("Failed to load yaml configuration from " + resource, ex);
}
} else {
return new MapPropertySource("Missing "+ resource.getFilename(), Collections.emptyMap());
}
}
代码示例来源:origin: com.okta.spring/okta-spring-sdk
private PropertySource<?> loadYaml(Resource resource, boolean required) {
YamlPropertySourceLoader loader = new YamlPropertySourceLoader();
if (!resource.exists() && required) {
throw new IllegalArgumentException("Resource " + resource + " does not exist");
}
if (resource.exists()) {
try {
List<PropertySource<?>> list = loader.load(resource.getFilename(), resource);
return list.get(0);
} catch (IOException ex) {
throw new IllegalStateException("Failed to load yaml configuration from " + resource, ex);
}
} else {
return new MapPropertySource("Missing "+ resource.getFilename(), Collections.emptyMap());
}
}
代码示例来源:origin: yuboon/Aooms
public PropertySource<?> createPropertySource(@Nullable String name, EncodedResource resource) throws IOException {
/*if (resource == null) {
super.createPropertySource(name, resource);
}*/
List<PropertySource<?>> propertySourceList = new YamlPropertySourceLoader().load(resource.getResource().getFilename(),resource.getResource());
return propertySourceList.get(0);
}
代码示例来源:origin: spring-cloud/spring-cloud-cli
private PropertySource<?> loadPropertySource(Resource resource, String path) {
if (resource.exists()) {
try {
List<PropertySource<?>> sources = new YamlPropertySourceLoader().load(path,
resource);
if (sources != null) {
logger.info("Loaded YAML properties from: " + resource);
} else if (sources == null || sources.isEmpty()){
return null;
}
CompositePropertySource composite = new CompositePropertySource("cli-sources");
for (PropertySource propertySource : sources) {
composite.addPropertySource(propertySource);
}
return composite;
}
catch (IOException e) {
}
}
return null;
}
代码示例来源:origin: spinnaker/fiat
@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);
}
}
}
代码示例来源:origin: spring-cloud/spring-cloud-open-service-broker
@Test
public void bindMinimumValidYaml() throws Exception {
this.context.register(ServiceBrokerPropertiesConfiguration.class);
Resource resource = context.getResource("classpath:catalog-minimal.yml");
YamlPropertySourceLoader sourceLoader = new YamlPropertySourceLoader();
List<PropertySource<?>> properties = sourceLoader.load("catalog", resource);
context.getEnvironment().getPropertySources().addFirst(properties.get(0));
validateMinimumCatalog();
}
本文整理了Java中org.springframework.boot.env.YamlPropertySourceLoader.load()方法的一些代码示例,展示了YamlPropertySourc
本文整理了Java中org.springframework.boot.env.YamlPropertySourceLoader.()方法的一些代码示例,展示了YamlPropertySourceLoa
本文整理了Java中io.micronaut.context.env.yaml.YamlPropertySourceLoader.processMap()方法的一些代码示例,展示了YamlProper
本文整理了Java中io.micronaut.context.env.yaml.YamlPropertySourceLoader.isSnakeYamlPresent()方法的一些代码示例,展示了Ya
我是一名优秀的程序员,十分优秀!