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


Java PropertySourcesPlaceholderConfigurer.setProperties方法代码示例

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


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

示例1: propertyPlaceholderConfigurer

import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; //导入方法依赖的package包/类
@Bean
public static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
    PropertySourcesPlaceholderConfigurer placeholderConfigurer = new PropertySourcesPlaceholderConfigurer();
    placeholderConfigurer.setFileEncoding("UTF-8");

    Properties properties = EnvLoader.getEnvs();
    if (properties.isEmpty()) {
        ParamsHome.getInstance().init(StringUtils.EMPTY);
        EnvLoader.init();
        IniLoader.init();

        properties = EnvLoader.getEnvs();
    }

    placeholderConfigurer.setProperties(properties);

    return placeholderConfigurer;
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:19,代码来源:LodsveCoreConfiguration.java

示例2: postProcessEmbeddedServletContainerFactory

import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; //导入方法依赖的package包/类
@Test
public void postProcessEmbeddedServletContainerFactory() throws Exception {
	RootBeanDefinition bd = new RootBeanDefinition(
			MockEmbeddedServletContainerFactory.class);
	MutablePropertyValues pv = new MutablePropertyValues();
	pv.add("port", "${port}");
	bd.setPropertyValues(pv);
	this.context.registerBeanDefinition("embeddedServletContainerFactory", bd);

	PropertySourcesPlaceholderConfigurer propertySupport = new PropertySourcesPlaceholderConfigurer();
	Properties properties = new Properties();
	properties.put("port", 8080);
	propertySupport.setProperties(properties);
	this.context.registerBeanDefinition("propertySupport",
			beanDefinition(propertySupport));

	this.context.refresh();
	assertThat(getEmbeddedServletContainerFactory().getContainer().getPort())
			.isEqualTo(8080);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:21,代码来源:EmbeddedWebApplicationContextTests.java

示例3: properties

import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; //导入方法依赖的package包/类
@Bean
public PropertySourcesPlaceholderConfigurer properties() {
    PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
    YamlPropertiesFactoryBean yamlPropertiesFactory = new YamlPropertiesFactoryBean();
    ConfigurationFileResourceResolver configurationFileResourceResolver = new ConfigurationFileResourceResolver();

    yamlPropertiesFactory.setResources(configurationFileResourceResolver.getResourceArray());
    propertySourcesPlaceholderConfigurer.setProperties(yamlPropertiesFactory.getObject());

    return propertySourcesPlaceholderConfigurer;
}
 
开发者ID:RFTDevGroup,项目名称:RFTBackend,代码行数:12,代码来源:CustomYamlConfig.java

示例4: configurer

import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; //导入方法依赖的package包/类
/**
 * Make vars.properties available to spring integration configuration
 * System properties are only used if there is no setting in vars.properties.
 */
@Bean(name = "aemServiceConfigurationPropertiesConfigurer")
public static PropertySourcesPlaceholderConfigurer configurer() {
    PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
    ppc.setLocation(new ClassPathResource("META-INF/spring/jwala-defaults.properties"));
    ppc.setLocalOverride(true);
    ppc.setProperties(ApplicationProperties.getProperties());
    return ppc;
}
 
开发者ID:cerner,项目名称:jwala,代码行数:13,代码来源:AemServiceConfiguration.java

示例5: properties

import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; //导入方法依赖的package包/类
@Bean
public static PropertySourcesPlaceholderConfigurer properties(@Qualifier("graviteeProperties") Properties graviteeProperties) {
    PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
    propertySourcesPlaceholderConfigurer.setProperties(graviteeProperties);
    propertySourcesPlaceholderConfigurer.setIgnoreUnresolvablePlaceholders(true);

    return propertySourcesPlaceholderConfigurer;
}
 
开发者ID:gravitee-io,项目名称:graviteeio-access-management,代码行数:9,代码来源:EnvironmentConfiguration.java

示例6: morePlaceholders

import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; //导入方法依赖的package包/类
@Bean
public static PropertySourcesPlaceholderConfigurer morePlaceholders() {
	PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
	configurer.setProperties(StringUtils
			.splitArrayElementsIntoProperties(new String[] { "foo=spam" }, "="));
	configurer.setLocalOverride(true);
	configurer.setOrder(0);
	return configurer;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:PropertyPlaceholderAutoConfigurationTests.java

示例7: properties

import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; //导入方法依赖的package包/类
@Bean
public static PropertySourcesPlaceholderConfigurer properties() {
    PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();

    propertySourcesPlaceholderConfigurer.setIgnoreResourceNotFound(false);

    ArrayList<String> defaultSources = new ArrayList(Arrays.asList("raptor.yml", appName + ".yml"));

    if (additionalConfigNames != null && !additionalConfigNames.isEmpty()) {
        defaultSources.addAll(additionalConfigNames);
    }

    ArrayList<String> sources = new ArrayList(defaultSources);

    if (developmentMode) {
        defaultSources.forEach((source) -> {
            sources.add(source.replace(".yml", ".dev.yml"));
        });
    }

    try {
        String envPath = System.getenv("CONFIG_BASEPATH");
        if (envPath != null && envPath.isEmpty()) {
            log.debug("Using CONFIG_BASEPATH={}", envPath);
            basepath = envPath;
        }
    } catch (Exception e) {
        log.warn("Failed to read environment variable CONFIG_BASEPATH: %s", e.getMessage());
    }

    log.debug("Configuration path {}", basepath);

    List<Resource> resources = sources.stream()
            .filter(f -> new File(basepath + f).exists())
            .map(f -> new FileSystemResource(basepath + f))
            .collect(Collectors.toList());

    log.debug("Configuration sources: {}", resources.toString());

    if (resources.isEmpty()) {
        throw new RuntimeException("Cannot find a loadable property file in: " + basepath);
    }

    YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
    yaml.setResources(resources.toArray(new Resource[]{}));

    propertySourcesPlaceholderConfigurer.setProperties(yaml.getObject());
    return propertySourcesPlaceholderConfigurer;
}
 
开发者ID:raptorbox,项目名称:raptor,代码行数:50,代码来源:BaseApplication.java


注:本文中的org.springframework.context.support.PropertySourcesPlaceholderConfigurer.setProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。