org.springframework.context.support.PropertySourcesPlaceholderConfigurer#setLocations ( )源码实例Demo

下面列出了org.springframework.context.support.PropertySourcesPlaceholderConfigurer#setLocations ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: MaxKey   文件: ApplicationAutoConfiguration.java
/**
 * propertySourcesPlaceholderConfigurer .
 * @return propertySourcesPlaceholderConfigurer
 * @throws IOException  null
 */
@Bean (name = "propertySourcesPlaceholderConfigurer")
public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer()
        throws IOException {
    ClassPathResource classPathResource1 = 
            new ClassPathResource(ConstantsProperties.classPathResource(
                    ConstantsProperties.applicationPropertySource));
    ClassPathResource classPathResource2 = 
            new ClassPathResource(ConstantsProperties.classPathResource(
                    ConstantsProperties.maxKeyPropertySource));

    PropertySourcesPlaceholderConfigurer configurer = 
            new PropertySourcesPlaceholderConfigurer();
    configurer.setLocations(
            classPathResource1,
            classPathResource2
    );
    configurer.setIgnoreUnresolvablePlaceholders(true);
    _logger.debug("PropertySourcesPlaceholderConfigurer init");
    return configurer;
}
 
源代码2 项目: molgenis   文件: MolgenisWebAppConfig.java
@Bean
public static PropertySourcesPlaceholderConfigurer properties() throws IOException {
  AppDataRootInitializer.init();

  PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
  Resource[] resources =
      new Resource[] {
        new FileSystemResource(
            AppDataRootProvider.getAppDataRoot().toString()
                + File.separator
                + "molgenis-server.properties"),
        new ClassPathResource("/molgenis.properties")
      };
  pspc.setLocations(resources);
  pspc.setFileEncoding("UTF-8");
  pspc.setIgnoreUnresolvablePlaceholders(true);
  pspc.setIgnoreResourceNotFound(true);
  pspc.setNullValue("@null");
  return pspc;
}
 
@Bean
public PropertySourcesPlaceholderConfigurer properties() {
    final PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
    try {
        configurer.setLocations(new PathMatchingResourcePatternResolver().getResources("file:/var/codedeploy/tomcat-sample/env.properties"));
    } catch (IOException e) {
        throw new RuntimeException("Failed to load resources.", e);
    }
    return configurer;
}
 
源代码4 项目: Profiles-Blog   文件: PropertiesConfiguration.java
protected static PropertySourcesPlaceholderConfigurer createPropertySourcesPlaceholderConfigurer(Resource... resources) {
    final PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
    ppc.setIgnoreUnresolvablePlaceholders(true);
    ppc.setIgnoreResourceNotFound(false);
    ppc.setLocations(resources);
    return ppc;
}
 
源代码5 项目: molgenis   文件: PlatformITConfig.java
@Bean
public static PropertySourcesPlaceholderConfigurer properties() {
  PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
  Resource[] resources = new Resource[] {new ClassPathResource("/conf/molgenis.properties")};
  pspc.setLocations(resources);
  pspc.setFileEncoding("UTF-8");
  pspc.setIgnoreUnresolvablePlaceholders(true);
  pspc.setIgnoreResourceNotFound(true);
  pspc.setNullValue("@null");
  return pspc;
}
 
@Bean
public static PropertySourcesPlaceholderConfigurer properties() {
  PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
  Resource[] resources = new Resource[] {new ClassPathResource("/conf/molgenis.properties")};
  pspc.setLocations(resources);
  pspc.setFileEncoding("UTF-8");
  pspc.setIgnoreUnresolvablePlaceholders(true);
  pspc.setIgnoreResourceNotFound(true);
  pspc.setNullValue("@null");
  return pspc;
}
 
@Bean
public static PropertySourcesPlaceholderConfigurer properties(){
    PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
    Resource[] resources = new ClassPathResource[]{ new ClassPathResource("foo.properties") };
    pspc.setLocations(resources);
    pspc.setIgnoreUnresolvablePlaceholders(true);
    return pspc;
}
 
源代码8 项目: AIDR   文件: ConfigLoader.java
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
	PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
	ClassPathResource locations[] = {
			new ClassPathResource("/application.properties"),
			new ClassPathResource("/environment.properties")};
	ppc.setLocations(locations);
	return ppc;
}
 
源代码9 项目: gerbil   文件: RootConfig.java
static @Bean public PropertySourcesPlaceholderConfigurer myPropertySourcesPlaceholderConfigurer() {
    PropertySourcesPlaceholderConfigurer p = new PropertySourcesPlaceholderConfigurer();
    Resource[] resourceLocations = new Resource[] { new ClassPathResource("gerbil.properties"), };
    p.setLocations(resourceLocations);
    return p;
}