Example usage for org.springframework.context.support PropertySourcesPlaceholderConfigurer setIgnoreResourceNotFound

List of usage examples for org.springframework.context.support PropertySourcesPlaceholderConfigurer setIgnoreResourceNotFound

Introduction

In this page you can find the example usage for org.springframework.context.support PropertySourcesPlaceholderConfigurer setIgnoreResourceNotFound.

Prototype

public void setIgnoreResourceNotFound(boolean ignoreResourceNotFound) 

Source Link

Document

Set if failure to find the property resource should be ignored.

Usage

From source file:com.clicktravel.cheddar.server.runtime.config.PropertiesConfigurationBuilder.java

public static PropertySourcesPlaceholderConfigurer configurer(final boolean isDevProfileActive,
        final String servicePropertiesPath) {
    final String environmentPropertiesPath = "com.clicktravel.services.env.properties";
    FeatureRegistry.init(environmentPropertiesPath);
    final PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
    configurer.setIgnoreResourceNotFound(true);

    // Note : Later property resources in this list override earlier ones
    final List<Resource> resources = new LinkedList<>();
    if (isDevProfileActive) {
        addResource(resources, "local-" + servicePropertiesPath); // TODO Remove when migrated to dev
        addResource(resources, "dev-" + servicePropertiesPath);
    } else {/*from ww w. j  a v  a 2s. c o m*/
        addResource(resources, servicePropertiesPath);
    }
    addResource(resources, "com.clicktravel.cheddar.server.properties");
    addResource(resources, environmentPropertiesPath);

    configurer.setLocations(resources.toArray(new Resource[0]));
    return configurer;
}

From source file:com.oneops.config.OneOpsConfig.java

/**
 * Property place holder config bean./*from  w  w  w .j  a  v  a  2 s . co m*/
 *
 * @return a pspc bean
 */
@Bean
public static PropertySourcesPlaceholderConfigurer pspc() {
    logger.info("Initializing Property source placeholder config...");
    PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
    pspc.setIgnoreResourceNotFound(true);
    pspc.setIgnoreUnresolvablePlaceholders(true);
    pspc.setOrder(1);
    return pspc;
}

From source file:com.cfitzarl.cfjwed.core.config.WebApplicationMvcConfigurer.java

@Bean
public static PropertySourcesPlaceholderConfigurer configurePropertiesLoader() {
    PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
    configurer.setIgnoreResourceNotFound(true);
    configurer.setLocations(new ClassPathResource("application.properties"),
            new FileSystemResource("/usr/local/cfjwed/application.properties"));
    return configurer;
}

From source file:dk.nsi.haiba.minipasconverter.config.MinipasConverterConfiguration.java

@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
    PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
    propertySourcesPlaceholderConfigurer.setIgnoreResourceNotFound(true);
    propertySourcesPlaceholderConfigurer.setIgnoreUnresolvablePlaceholders(false);

    propertySourcesPlaceholderConfigurer
            .setLocations(new Resource[] { new ClassPathResource("default-config.properties"),
                    new ClassPathResource("minipasconfig.properties") });

    return propertySourcesPlaceholderConfigurer;
}

From source file:dk.nsi.haiba.epimibaimporter.config.EPIMIBAConfiguration.java

@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
    PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
    propertySourcesPlaceholderConfigurer.setIgnoreResourceNotFound(true);
    propertySourcesPlaceholderConfigurer.setIgnoreUnresolvablePlaceholders(false);

    propertySourcesPlaceholderConfigurer
            .setLocations(new Resource[] { new ClassPathResource("default-config.properties"),
                    new ClassPathResource("epimibaconfig.properties") });

    return propertySourcesPlaceholderConfigurer;
}

From source file:dk.nsi.haiba.lprimporter.config.LPRConfiguration.java

@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
    PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
    propertySourcesPlaceholderConfigurer.setIgnoreResourceNotFound(true);
    propertySourcesPlaceholderConfigurer.setIgnoreUnresolvablePlaceholders(false);

    propertySourcesPlaceholderConfigurer
            .setLocations(new Resource[] { new ClassPathResource("default-config.properties"),
                    new ClassPathResource("lprconfig.properties") });

    return propertySourcesPlaceholderConfigurer;
}

From source file:de.thm.arsnova.config.ExtraConfig.java

@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
    final PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
    configurer.setLocations(new Resource[] { new ClassPathResource("arsnova.properties.example"),
            new FileSystemResource("/etc/arsnova/arsnova.properties"), });
    configurer.setIgnoreResourceNotFound(true);
    configurer.setIgnoreUnresolvablePlaceholders(false);
    return configurer;
}

From source file:org.geosdi.geoplatform.experimental.connector.core.spring.placeholder.OAuth2CorePlaceholderConfig.java

@Bean
public static PropertySourcesPlaceholderConfigurer oauth2CorePropertyConfigurer(
        @Value("#{systemProperties['GP_DATA_DIR']}") String gpConfigDataDir,
        @Value("#{systemProperties['OAUTH2_CORE_FILE_PROP']}") String oauth2CoreFileProp)
        throws MalformedURLException {

    PropertySourcesPlaceholderConfigurer corePC = new PropertySourcesPlaceholderConfigurer();
    corePC.setPlaceholderPrefix("oauth2CoreConfigurator{");
    corePC.setPlaceholderSuffix("}");
    corePC.setNullValue("@null");

    corePC.setLocations(placeholderResourcesLoader.loadResources(gpConfigDataDir, oauth2CoreFileProp));
    corePC.setIgnoreResourceNotFound(Boolean.TRUE);
    corePC.setIgnoreUnresolvablePlaceholders(Boolean.TRUE);

    return corePC;
}

From source file:it.cnr.missioni.connector.core.spring.placeholder.MissioniCorePlaceholderConfig.java

@Bean
public static PropertySourcesPlaceholderConfigurer oauth2CorePropertyConfigurer(
        @Value("#{systemProperties['GP_DATA_DIR']}") String gpConfigDataDir,
        @Value("#{systemProperties['MISSIONI_CORE_FILE_PROP']}") String missioniCoreFileProp)
        throws MalformedURLException {

    PropertySourcesPlaceholderConfigurer corePC = new PropertySourcesPlaceholderConfigurer();
    corePC.setPlaceholderPrefix("missioniCoreConfigurator{");
    corePC.setPlaceholderSuffix("}");
    corePC.setNullValue("@null");

    corePC.setLocations(placeholderResourcesLoader.loadResources(gpConfigDataDir, missioniCoreFileProp));
    corePC.setIgnoreResourceNotFound(Boolean.TRUE);
    corePC.setIgnoreUnresolvablePlaceholders(Boolean.TRUE);

    return corePC;
}

From source file:de.thm.arsnova.config.SecurityConfig.java

@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
    final PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
    configurer.setLocations(new Resource[] { new ClassPathResource("arsnova.properties.example"),
            new FileSystemResource("file:///etc/arsnova/arsnova.properties"), });
    configurer.setIgnoreResourceNotFound(true);
    configurer.setIgnoreUnresolvablePlaceholders(false);

    return configurer;
}