List of usage examples for org.springframework.context.support PropertySourcesPlaceholderConfigurer PropertySourcesPlaceholderConfigurer
PropertySourcesPlaceholderConfigurer
From source file:com.kdubb.socialshowcaseboot.config.MainConfig.java
@Bean public PropertySourcesPlaceholderConfigurer propertyPlaceHolderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); }
From source file:fr.treeptik.cloudunit.initializer.CloudUnitApplicationContext.java
@Bean @Profile("vagrant") public static PropertySourcesPlaceholderConfigurer properties() throws Exception { PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); Resource[] resources = new Resource[] { new ClassPathResource("application-vagrant.properties") }; pspc.setLocations(resources);/* w w w . j ava 2 s .co m*/ pspc.setIgnoreUnresolvablePlaceholders(true); pspc.setLocalOverride(true); return pspc; }
From source file:com.springsource.html5expense.config.WebConfig.java
@Bean public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); }
From source file:de.thischwa.pmcms.conf.BasicConfigurator.java
private void init() { if (System.getProperty("data.dir") == null) throw new IllegalArgumentException("No data directory set!"); dataDir = new File(System.getProperty("data.dir")); if (!dataDir.exists()) throw new IllegalArgumentException( String.format("Data directory not found: %s", dataDir.getAbsolutePath())); // load and merge the properties loadProperties();/*from w w w .j a v a2s . c o m*/ // build special props String baseUrl = String.format("http://%s:%s/", props.get("pmcms.jetty.host"), props.get("pmcms.jetty.port")); props.setProperty("baseurl", baseUrl); props.setProperty("data.dir", dataDir.getAbsolutePath()); System.setProperty("content.types.user.table", new File(Constants.APPLICATION_DIR, "lib/content-types.properties").getAbsolutePath()); // init log4j LogManager.resetConfiguration(); PropertyConfigurator.configure(PropertiesTool.getProperties(props, "log4j")); Logger logger = Logger.getLogger(BasicConfigurator.class); logger.info("*** log4j initialized!"); // init the spring framework try { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.scan("de.thischwa.pmcms"); PropertySourcesPlaceholderConfigurer config = new PropertySourcesPlaceholderConfigurer(); config.setProperties(props); config.postProcessBeanFactory(ctx.getDefaultListableBeanFactory()); ctx.refresh(); context = ctx; logger.info("*** Spring initialized!"); PropertiesManager pm = context.getBean(PropertiesManager.class); pm.setProperties(props); } catch (Exception e) { throw new RuntimeException(e); } logger.info("*** Basic configuration successful done."); }
From source file:com.miko.s4netty.config.WorkerNettyConfig.java
/** * IMPORTANT: quite necessary to make the Value annotations work. * * @return/*w w w . ja va2s . c om*/ */ @Bean public static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); }
From source file:fr.treeptik.cloudunit.initializer.CloudUnitApplicationContext.java
@Bean @Profile("production") public static PropertySourcesPlaceholderConfigurer propertiesForProduction() throws Exception { PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); File customFile = new File(System.getProperty("user.home") + "/.cloudunit/configuration.properties"); Resource[] resources = null;/*ww w . j a v a 2 s.com*/ if (customFile.exists()) { resources = new Resource[] { new ClassPathResource("application-production.properties"), new FileSystemResource( new File(System.getProperty("user.home") + "/.cloudunit/configuration.properties")) }; } else { logger.error(customFile.getAbsolutePath() + " is missing. It could generate configuration error"); resources = new Resource[] { new ClassPathResource("application-production.properties"), }; } pspc.setLocations(resources); pspc.setIgnoreUnresolvablePlaceholders(true); pspc.setLocalOverride(true); return pspc; }
From source file:com.epam.ta.reportportal.TestConfig.java
@Bean public static PropertySourcesPlaceholderConfigurer propertiesResolver() { return new 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:cn.org.once.cstack.initializer.CloudUnitApplicationContext.java
@Bean @Profile("vagrant") public static PropertySourcesPlaceholderConfigurer properties() throws Exception { String file = "application-vagrant.properties"; PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); pspc.setLocations(getResources(file)); pspc.setIgnoreUnresolvablePlaceholders(true); pspc.setLocalOverride(true);//w w w .j ava 2s.c o m return pspc; }