placeholderConfigurer.setProperties(factoryBean.getObject()); placeholderConfigurer.setLocalOverride(true); context.addBeanFactoryPostProcessor(placeholderConfigurer); context.refresh(); ldapManagerActual = (AuthenticationManager)context.getBean("ldapAuthenticationManager");
PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); configurer.setLocation(new ClassPathResource("context.properties")); ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[]{"applicationContext.xml"}, false); applicationContext.addBeanFactoryPostProcessor(configurer); applicationContext.refresh();
... Properties props = new Properties(); props.put("contextID", contextID); PropertyPlaceholderConfigurer conf = new PropertyPlaceholderConfigurer(); conf.setProperties(props); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(); context.addBeanFactoryPostProcessor(conf); context.setConfigLocation("beans/main.xml"); context.refresh(); ...
public static KieModuleModel fromXML(java.net.URL kModuleUrl, ReleaseId releaseId){ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(); KModuleBeanFactoryPostProcessor beanFactoryPostProcessor = new KModuleBeanFactoryPostProcessor(kModuleUrl, context); beanFactoryPostProcessor.setReleaseId(releaseId); context.addBeanFactoryPostProcessor(beanFactoryPostProcessor); context.setConfigLocation(kModuleUrl.toExternalForm()); context.refresh(); context.registerShutdownHook(); return null;//kieSpringApplicationListener.getKieModuleModel(); }
public static KieModuleModel fromXML(java.net.URL kModuleUrl, ReleaseId releaseId){ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(); KModuleBeanFactoryPostProcessor beanFactoryPostProcessor = new KModuleBeanFactoryPostProcessor(kModuleUrl, context); beanFactoryPostProcessor.setReleaseId(releaseId); context.addBeanFactoryPostProcessor(beanFactoryPostProcessor); context.setConfigLocation(kModuleUrl.toExternalForm()); context.refresh(); context.registerShutdownHook(); return null;//kieSpringApplicationListener.getKieModuleModel(); }
public void setNamePassword(){ //some code PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); Properties properties = new Properties(); properties.setProperty("property.userName", "username"); properties.setProperty("property.password", "password"); configurer.setProperties(properties); //Include below line if you have another //PropertyPlaceholderConfigurer in springConfigXml2.xml configurer.setIgnoreUnresolvablePlaceholders(true); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(); context.addBeanFactoryPostProcessor(configurer); context.setConfigLocation("springConfigXml2.xml"); context.refresh(); //some code } springConfigXml2.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean id="asyncListener" class="com.example.AsyncListenerClass"> <property name="userName" value="${property.userName}"/> <property name="password" value="${property.password}"/> </bean> </beans>
private AbstractApplicationContext readContextFromFile(final String filePath) { final ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[] { filePath }, false); final PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer(); propertyPlaceholderConfigurer.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE); propertyPlaceholderConfigurer.setIgnoreResourceNotFound(true); propertyPlaceholderConfigurer.setLocations(PROPERTIES_LOCATIONS); applicationContext.addBeanFactoryPostProcessor(propertyPlaceholderConfigurer); applicationContext.refresh(); return applicationContext; }
applicationContext.addBeanFactoryPostProcessor( new DSpaceBeanFactoryPostProcessor(parent, configurationService, testMode) ); applicationContext.refresh(); if (developmentMode) {
applicationContext.addBeanFactoryPostProcessor( new DSpaceBeanFactoryPostProcessor(parent, configurationService, testMode) ); applicationContext.refresh(); if (developmentMode) {
properties.put("simulationRunId", configuration); propConfig.setProperties(properties); appContext.addBeanFactoryPostProcessor(propConfig); appContext.refresh();
properties.put("simulationRunId", configuration); propConfig.setProperties(properties); appContext.addBeanFactoryPostProcessor(propConfig); appContext.refresh();
@Override public void startup() { long startTime = System.currentTimeMillis(); // get all spring config paths String[] allPaths = getSpringPaths(testMode, configPaths, configurationService); applicationContext = new ClassPathXmlApplicationContext(allPaths, false); // Make sure that the spring files from the config directoy can override the spring files from our jars applicationContext.setAllowBeanDefinitionOverriding(true); applicationContext.setAllowCircularReferences(true); //applicationContext.registerShutdownHook(); // this interferes with the kernel shutdown hook // add the config interceptors (partially done in the xml) applicationContext .addBeanFactoryPostProcessor(new DSpaceBeanFactoryPostProcessor(parent, configurationService, testMode)); applicationContext.refresh(); if (developmentMode) { log.warn("Spring Service Manager is running in developmentMode, services will be loaded on demand only"); // TODO find a way to set this sucker to super duper lazy mode? it is currently not actually doing it } else { applicationContext.getBeanFactory().preInstantiateSingletons(); applicationContext.getBeanFactory().freezeConfiguration(); } long totalTime = System.currentTimeMillis() - startTime; log.info("Spring Service Manager started up in " + totalTime + " ms with " + applicationContext .getBeanDefinitionCount() + " services..."); }
@Before public void createSpringContext() { try { log.info( "creating spring context" ); PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); Properties properties = new Properties(); properties.setProperty( "temp.dir", TMPDIR ); configurer.setProperties( properties ); ctx = new ClassPathXmlApplicationContext(); ctx.addBeanFactoryPostProcessor( configurer ); ctx.setConfigLocation("org/drools/container/spring/beans/persistence/beansVarPersistence.xml"); ctx.refresh(); } catch ( Exception e ) { log.error( "can't create spring context", e ); throw new RuntimeException( e ); } }
@Before public void createSpringContext() { try { log.debug("creating spring context"); PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); Properties properties = new Properties(); properties.setProperty("temp.dir", TMPDIR); configurer.setProperties(properties); ctx = new ClassPathXmlApplicationContext(); ctx.addBeanFactoryPostProcessor(configurer); ctx.setConfigLocation("org/kie/spring/timer/conf/spring-conf.xml"); ctx.refresh(); } catch (Exception e) { log.error("can't create spring context", e); throw new RuntimeException(e); } }
@Before public void createSpringContext() { try { log.debug("creating spring context"); PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); Properties properties = new Properties(); properties.setProperty("temp.dir", TMPDIR); configurer.setProperties(properties); ctx = new ClassPathXmlApplicationContext(); ctx.addBeanFactoryPostProcessor(configurer); ctx.setConfigLocation("org/kie/spring/timer/conf/spring-conf.xml"); ctx.refresh(); } catch (Exception e) { log.error("can't create spring context", e); throw new RuntimeException(e); } }
@Before public void createSpringContext() { try { log.info( "creating spring context" ); PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); Properties properties = new Properties(); properties.setProperty( "temp.dir", TMPDIR ); configurer.setProperties( properties ); ctx = new ClassPathXmlApplicationContext(); ctx.addBeanFactoryPostProcessor( configurer ); //ctx.setConfigLocation( "org/drools/container/spring/beans/persistence/beans.xml" ); ctx.setConfigLocation("org/drools/container/spring/beans/persistence/beans_Env.xml"); ctx.refresh(); } catch ( Exception e ) { log.error( "can't create spring context", e ); throw new RuntimeException( e ); } }
@Before public void createSpringContext() { try { log.info( "creating spring context" ); PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); Properties properties = new Properties(); properties.setProperty( "temp.dir", TMPDIR ); configurer.setProperties(properties); ctx = new ClassPathXmlApplicationContext(); ctx.addBeanFactoryPostProcessor( configurer ); //ctx.setConfigLocation( "org/drools/container/spring/beans/persistence/beansVarPersistence.xml" ); ctx.setConfigLocation("org/drools/container/spring/beans/persistence/beansVarPersistence_Env.xml"); ctx.refresh(); } catch ( Exception e ) { log.error( "can't create spring context", e ); throw new RuntimeException( e ); } }
@Before public void createSpringContext() { try { log.info( "creating spring context" ); PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); Properties properties = new Properties(); properties.setProperty( "temp.dir", TMPDIR ); configurer.setProperties( properties ); ctx = new ClassPathXmlApplicationContext(); ctx.addBeanFactoryPostProcessor( configurer ); ctx.setConfigLocation("org/drools/container/spring/timer/conf/spring-conf.xml"); ctx.refresh(); } catch ( Exception e ) { log.error( "can't create spring context", e ); throw new RuntimeException( e ); } }
@Before public void createSpringContext() { try { log.info( "creating spring context" ); PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); Properties properties = new Properties(); properties.setProperty( "temp.dir", TMPDIR ); configurer.setProperties( properties ); ctx = new ClassPathXmlApplicationContext(); ctx.addBeanFactoryPostProcessor( configurer ); ctx.setConfigLocation("org/drools/container/spring/beans/persistence/beans.xml"); ctx.refresh(); } catch ( Exception e ) { log.error( "can't create spring context", e ); throw new RuntimeException( e ); } }
properties.put("simulationRunId", configuration); propConfig.setProperties(properties); appContext.addBeanFactoryPostProcessor(propConfig); appContext.refresh();