List of usage examples for org.springframework.context.support PropertySourcesPlaceholderConfigurer PropertySourcesPlaceholderConfigurer
PropertySourcesPlaceholderConfigurer
From source file:br.sp.mandala.config.AppConfiguration.java
/** * Creates and configures the DriverManagerDataSource datasource bean. * * @param env The runtime environment of our application. * @return/*from www.ja v a 2 s .co m*/ */ @Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); }
From source file:de.hoegertn.demo.cxfsimple.SpringStarter.java
public final void doStart() throws Exception { try {/*ww w . jav a 2s.c o m*/ this.doBeforeSpringStart(); } catch (Exception e) { throw new RuntimeException("Before spring failed", e); } Lock writeLock = this.rwLock.writeLock(); AbstractXmlApplicationContext ctx = null; try { writeLock.lock(); if (this.context.get() != null) { throw new RuntimeException("Already started"); } ctx = this.createSpringContext(); final PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setProperties(System.getProperties()); ctx.addBeanFactoryPostProcessor(configurer); ctx.setConfigLocation(this.getSpringResource()); ctx.refresh(); } catch (Exception e) { if (ctx != null) { try { ctx.close(); } catch (Exception e1) { this.logger.warn("Failed to close context", e1); } ctx = null; } throw new RuntimeException("Spring context failed", e); } finally { if (ctx != null) { this.context.set(ctx); } writeLock.unlock(); } try { this.doAfterSpringStart(); } catch (Exception e) { throw new RuntimeException("After spring failed", e); } }
From source file:com.open.license.config.ContextConfig.java
@Bean public PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() { log.info("[START:Load Application Properties]"); String propertiesFilename = "/application-" + APP_ENV + ".properties"; PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setLocation(new ClassPathResource(propertiesFilename)); log.info("[ACTIVATE:Profile " + APP_ENV + "]"); log.info("[END:Load Application Properties]"); // Start ActiveMQ Broker if enabled startActiveMqBroker();/* w w w.j a va2 s .c o m*/ return configurer; }
From source file:org.osgp.adapter.protocol.dlms.application.config.ApplicationContext.java
@Bean public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { final PropertySourcesPlaceholderConfigurer propertySource = new PropertySourcesPlaceholderConfigurer(); propertySource.setIgnoreUnresolvablePlaceholders(true); return propertySource; }
From source file:ltistarter.Application.java
/** * Allows access to the various config values (from application.properties) using @Value *///from ww w .j a v a2 s. c om @Bean public static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer() { @Override protected void doProcessProperties(ConfigurableListableBeanFactory beanFactoryToProcess, StringValueResolver valueResolver) { log.info("doProcessProperties"); super.doProcessProperties(beanFactoryToProcess, valueResolver); } }; }
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:de.taimos.daemon.spring.SpringDaemonAdapter.java
@Override public final void doStart() throws Exception { super.doStart(); try {/*from w w w. java 2 s .c o m*/ this.doBeforeSpringStart(); } catch (Exception e) { throw new RuntimeException("Before spring failed", e); } Lock writeLock = this.rwLock.writeLock(); AbstractXmlApplicationContext ctx = null; try { writeLock.lock(); if (this.context.get() != null) { throw new RuntimeException("Already started"); } ctx = this.createSpringContext(); String[] profiles = System.getProperty(Configuration.PROFILES, Configuration.PROFILES_PRODUCTION) .split(","); ctx.getEnvironment().setActiveProfiles(profiles); final PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setProperties(DaemonStarter.getDaemonProperties()); ctx.addBeanFactoryPostProcessor(configurer); ctx.setConfigLocation(this.getSpringResource()); ctx.refresh(); } catch (Exception e) { if (ctx != null) { try { ctx.close(); } catch (Exception e1) { this.logger.warn("Failed to close context", e1); } ctx = null; } throw new RuntimeException("Spring context failed", e); } finally { if (ctx != null) { this.context.set(ctx); } writeLock.unlock(); } try { this.doAfterSpringStart(); } catch (Exception e) { throw new RuntimeException("After spring failed", e); } }
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:io.gravitee.gateway.handlers.api.ApiContextHandlerFactory.java
AbstractApplicationContext createApplicationContext(Api api) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.setParent(gatewayApplicationContext); context.setClassLoader(new ReactorHandlerClassLoader(gatewayApplicationContext.getClassLoader())); context.setEnvironment((ConfigurableEnvironment) gatewayApplicationContext.getEnvironment()); PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setIgnoreUnresolvablePlaceholders(true); configurer.setEnvironment(gatewayApplicationContext.getEnvironment()); context.addBeanFactoryPostProcessor(configurer); context.getBeanFactory().registerSingleton("api", api); context.register(ApiHandlerConfiguration.class); context.setId("context-api-" + api.getName()); context.refresh();//ww w.j av a 2s . c om return context; }
From source file:com.ethercamp.harmony.config.ApplicationConfig.java
public static PropertySourcesPlaceholderConfigurer propertyConfigIn() { return new PropertySourcesPlaceholderConfigurer(); }