本文整理匯總了Java中org.springframework.context.support.GenericApplicationContext.addBeanFactoryPostProcessor方法的典型用法代碼示例。如果您正苦於以下問題:Java GenericApplicationContext.addBeanFactoryPostProcessor方法的具體用法?Java GenericApplicationContext.addBeanFactoryPostProcessor怎麽用?Java GenericApplicationContext.addBeanFactoryPostProcessor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.context.support.GenericApplicationContext
的用法示例。
在下文中一共展示了GenericApplicationContext.addBeanFactoryPostProcessor方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
bundleContext = new MockBundleContext();
applicationContext = new GenericApplicationContext();
applicationContext.setClassLoader(getClass().getClassLoader());
applicationContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
applicationContext.addBeanFactoryPostProcessor(new BeanFactoryPostProcessor() {
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
beanFactory.addPropertyEditorRegistrar(new BlueprintEditorRegistrar());
}
});
reader = new XmlBeanDefinitionReader(applicationContext);
reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
reader.loadBeanDefinitions(new ClassPathResource(getConfig(), getClass()));
applicationContext.refresh();
blueprintContainer = new SpringBlueprintContainer(applicationContext);
}
示例2: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
bundleContext = new MockBundleContext();
context = new GenericApplicationContext();
context.setClassLoader(getClass().getClassLoader());
context.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
context.addBeanFactoryPostProcessor(new BeanFactoryPostProcessor() {
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
beanFactory.addPropertyEditorRegistrar(new BlueprintEditorRegistrar());
}
});
reader = new XmlBeanDefinitionReader(context);
reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
context.refresh();
blueprintContainer = new SpringBlueprintContainer(context);
}
示例3: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
bundleContext = new MockBundleContext();
context = new GenericApplicationContext();
context.setClassLoader(getClass().getClassLoader());
context.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
context.addBeanFactoryPostProcessor(new BeanFactoryPostProcessor() {
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
beanFactory.addPropertyEditorRegistrar(new BlueprintEditorRegistrar());
beanFactory.registerSingleton("blueprintContainer",
new SpringBlueprintContainer(context));
}
});
reader = new XmlBeanDefinitionReader(context);
reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
context.refresh();
blueprintContainer = new SpringBlueprintContainer(context);
}
示例4: testViewScopedClass
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
@Test
public void testViewScopedClass() {
GenericApplicationContext acx = new GenericApplicationContext();
AnnotationConfigUtils.registerAnnotationConfigProcessors(acx);
acx.registerBeanDefinition("viewScopedClass", new AnnotatedGenericBeanDefinition(
new StandardAnnotationMetadata(ViewScopedClass.class)));
acx.registerBeanDefinition("scopedBeansConfiguration", new RootBeanDefinition(
ScopedBeansConfiguration.class));
acx.addBeanFactoryPostProcessor(JsfScopeAnnotationsAutoConfiguration.jsfScopeAnnotationsConfigurer(acx.getEnvironment()));
acx.addBeanFactoryPostProcessor(CdiScopeAnnotationsAutoConfiguration.cdiScopeAnnotationsConfigurer(acx.getEnvironment()));
acx.refresh();
assertThat(acx.getBeanDefinition("viewScopedClass").getScope())
.isEqualTo(ViewScope.SCOPE_VIEW);
assertThat(acx.getBeanDefinition("viewScopedBean").getScope())
.isEqualTo(ViewScope.SCOPE_VIEW);
}
開發者ID:joinfaces,項目名稱:joinfaces,代碼行數:19,代碼來源:JsfCdiToSpringApplicationBeanFactoryPostProcessorIT.java
示例5: testSessionScopedClass
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
@Test
public void testSessionScopedClass() {
GenericApplicationContext acx = new GenericApplicationContext();
AnnotationConfigUtils.registerAnnotationConfigProcessors(acx);
acx.registerBeanDefinition("sessionScopedClass", new AnnotatedGenericBeanDefinition(
new StandardAnnotationMetadata(SessionScopedClass.class)));
acx.registerBeanDefinition("scopedBeansConfiguration", new RootBeanDefinition(
ScopedBeansConfiguration.class));
acx.addBeanFactoryPostProcessor(JsfScopeAnnotationsAutoConfiguration.jsfScopeAnnotationsConfigurer(acx.getEnvironment()));
acx.addBeanFactoryPostProcessor(CdiScopeAnnotationsAutoConfiguration.cdiScopeAnnotationsConfigurer(acx.getEnvironment()));
acx.refresh();
assertThat(acx.getBeanDefinition("sessionScopedClass").getScope())
.isEqualTo(WebApplicationContext.SCOPE_SESSION);
assertThat(acx.getBeanDefinition("sessionScopedBean").getScope())
.isEqualTo(WebApplicationContext.SCOPE_SESSION);
}
開發者ID:joinfaces,項目名稱:joinfaces,代碼行數:19,代碼來源:JsfCdiToSpringApplicationBeanFactoryPostProcessorIT.java
示例6: testNoScopedClass
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
@Test
public void testNoScopedClass() {
GenericApplicationContext acx = new GenericApplicationContext();
AnnotationConfigUtils.registerAnnotationConfigProcessors(acx);
acx.registerBeanDefinition("noScopedClass", new AnnotatedGenericBeanDefinition(
new StandardAnnotationMetadata(NoScopedClass.class)));
acx.registerBeanDefinition("scopedBeansConfiguration", new RootBeanDefinition(
ScopedBeansConfiguration.class));
acx.addBeanFactoryPostProcessor(JsfScopeAnnotationsAutoConfiguration.jsfScopeAnnotationsConfigurer(acx.getEnvironment()));
acx.addBeanFactoryPostProcessor(CdiScopeAnnotationsAutoConfiguration.cdiScopeAnnotationsConfigurer(acx.getEnvironment()));
acx.refresh();
assertThat(acx.getBeanDefinition("noScopedClass").getScope())
.isEqualTo("");
assertThat(acx.getBeanDefinition("noScopedBean").getScope())
.isEqualTo("");
}
開發者ID:joinfaces,項目名稱:joinfaces,代碼行數:20,代碼來源:JsfCdiToSpringApplicationBeanFactoryPostProcessorIT.java
示例7: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
bundleContext = new MockBundleContext();
context = new GenericApplicationContext();
context.setClassLoader(getClass().getClassLoader());
context.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
context.addBeanFactoryPostProcessor(new BeanFactoryPostProcessor() {
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
beanFactory.addPropertyEditorRegistrar(new BlueprintEditorRegistrar());
}
});
reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
context.refresh();
BlueprintContainer = new SpringBlueprintContainer(context);
}
示例8: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
bundleContext = new MockBundleContext();
context = new GenericApplicationContext();
context.setClassLoader(getClass().getClassLoader());
context.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
context.addBeanFactoryPostProcessor(new CycleOrderingProcessor());
reader = new XmlBeanDefinitionReader(context);
reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
context.refresh();
blueprintContainer = new SpringBlueprintContainer(context);
}
示例9: createContext
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
private GenericApplicationContext createContext(Class<?> configClass) {
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
if (customScope != null) {
beanFactory.registerScope(SCOPE, customScope);
}
beanFactory.registerBeanDefinition("config", new RootBeanDefinition(configClass));
GenericApplicationContext ctx = new GenericApplicationContext(beanFactory);
ctx.addBeanFactoryPostProcessor(new ConfigurationClassPostProcessor());
ctx.refresh();
return ctx;
}
示例10: assertAdviceWasApplied
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
private void assertAdviceWasApplied(Class<?> configClass) {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(
new ClassPathResource("aspectj-autoproxy-config.xml", ConfigurationClassAspectIntegrationTests.class));
GenericApplicationContext ctx = new GenericApplicationContext(factory);
ctx.addBeanFactoryPostProcessor(new ConfigurationClassPostProcessor());
ctx.registerBeanDefinition("config", new RootBeanDefinition(configClass));
ctx.refresh();
TestBean testBean = ctx.getBean("testBean", TestBean.class);
assertThat(testBean.getName(), equalTo("name"));
testBean.absquatulate();
assertThat(testBean.getName(), equalTo("advisedName"));
}
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:15,代碼來源:ConfigurationClassAspectIntegrationTests.java
示例11: getBaseContext
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
/**
* Get a basic Spring {@link GenericApplicationContext} with additional
* custom editors registered. The additional custom editors are automatically
* loaded from com.fortify.util.spring.propertyeditor (sub-)packages
* if they have the {@link Component} annotation.
* @return Basic Spring ApplicationContext with custom editors registered.
*/
public static final GenericApplicationContext getBaseContext() {
GenericApplicationContext context = new GenericApplicationContext();
context.setClassLoader(SpringContextUtil.class.getClassLoader());
CustomEditorConfigurer cec = new CustomEditorConfigurer();
cec.setCustomEditors(PROPERTY_EDITORS);
context.addBeanFactoryPostProcessor(cec);
return context;
}