本文整理了Java中org.springframework.context.support.ClassPathXmlApplicationContext.addBeanFactoryPostProcessor()
方法的一些代码示例,展示了ClassPathXmlApplicationContext.addBeanFactoryPostProcessor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ClassPathXmlApplicationContext.addBeanFactoryPostProcessor()
方法的具体详情如下:
包路径:org.springframework.context.support.ClassPathXmlApplicationContext
类名称:ClassPathXmlApplicationContext
方法名:addBeanFactoryPostProcessor
暂无
代码示例来源:origin: cloudfoundry/uaa
placeholderConfigurer.setProperties(factoryBean.getObject());
placeholderConfigurer.setLocalOverride(true);
context.addBeanFactoryPostProcessor(placeholderConfigurer);
context.refresh();
ldapManagerActual = (AuthenticationManager)context.getBean("ldapAuthenticationManager");
代码示例来源:origin: stackoverflow.com
PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
configurer.setLocation(new ClassPathResource("context.properties"));
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[]{"applicationContext.xml"}, false);
applicationContext.addBeanFactoryPostProcessor(configurer);
applicationContext.refresh();
代码示例来源:origin: stackoverflow.com
...
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();
...
代码示例来源:origin: kiegroup/droolsjbpm-integration
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();
}
代码示例来源:origin: org.kie/kie-spring
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();
}
代码示例来源:origin: stackoverflow.com
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>
代码示例来源:origin: pl.edu.icm.synat/synat-platform-integration-tests
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;
}
代码示例来源:origin: org.dspace/dspace-services-impl
applicationContext.addBeanFactoryPostProcessor( new DSpaceBeanFactoryPostProcessor(parent, configurationService, testMode) );
applicationContext.refresh();
if (developmentMode) {
代码示例来源:origin: org.dspace/dspace-services
applicationContext.addBeanFactoryPostProcessor( new DSpaceBeanFactoryPostProcessor(parent, configurationService, testMode) );
applicationContext.refresh();
if (developmentMode) {
代码示例来源:origin: martin-grofcik/activiti-crystalball
properties.put("simulationRunId", configuration);
propConfig.setProperties(properties);
appContext.addBeanFactoryPostProcessor(propConfig);
appContext.refresh();
代码示例来源:origin: martin-grofcik/activiti-crystalball
properties.put("simulationRunId", configuration);
propConfig.setProperties(properties);
appContext.addBeanFactoryPostProcessor(propConfig);
appContext.refresh();
代码示例来源:origin: DSpace/DSpace
@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...");
}
代码示例来源:origin: org.drools/drools-spring-legacy5
@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 );
}
}
代码示例来源:origin: org.kie/kie-spring
@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);
}
}
代码示例来源:origin: kiegroup/droolsjbpm-integration
@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);
}
}
代码示例来源:origin: org.drools/drools-spring-legacy5
@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 );
}
}
代码示例来源:origin: org.drools/drools-spring-legacy5
@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 );
}
}
代码示例来源:origin: org.drools/drools-spring-legacy5
@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 );
}
}
代码示例来源:origin: org.drools/drools-spring-legacy5
@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 );
}
}
代码示例来源:origin: martin-grofcik/activiti-crystalball
properties.put("simulationRunId", configuration);
propConfig.setProperties(properties);
appContext.addBeanFactoryPostProcessor(propConfig);
appContext.refresh();
内容来源于网络,如有侵权,请联系作者删除!