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);
}
java类org.springframework.beans.factory.config.BeanFactoryPostProcessor的实例源码
BaseMetadataTest.java 文件源码
项目:gemini.blueprint
阅读 19
收藏 0
点赞 0
评论 0
NestedDefinitionMetadataTest.java 文件源码
项目:gemini.blueprint
阅读 20
收藏 0
点赞 0
评论 0
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);
}
TestLazyBeansTest.java 文件源码
项目:gemini.blueprint
阅读 23
收藏 0
点赞 0
评论 0
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);
}
LazyExporterTest.java 文件源码
项目:gemini.blueprint
阅读 21
收藏 0
点赞 0
评论 0
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);
}
MonitorAutoconfiguration.java 文件源码
项目:saluki
阅读 23
收藏 0
点赞 0
评论 0
@Bean
public BeanFactoryPostProcessor beanFactoryPostProcessor(ApplicationContext applicationContext) {
return new BeanFactoryPostProcessor() {
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
if (beanFactory instanceof BeanDefinitionRegistry) {
try {
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(registry);
scanner.setResourceLoader(applicationContext);
scanner.scan("com.quancheng.saluki.boot.web");
} catch (Throwable e) {
log.error(e.getMessage(), e);
}
}
}
};
}
ApplicationContextCreator.java 文件源码
项目:springmock
阅读 16
收藏 0
点赞 0
评论 0
public static ApplicationContext buildAppContext(ApplicationContext parent, Stream<TestBean> beans, Collection<BeanFactoryPostProcessor> postProcessors) {
final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
final GenericApplicationContext applicationContext = new GenericApplicationContext(beanFactory, parent);
postProcessors.forEach(applicationContext::addBeanFactoryPostProcessor);
beans.forEach(entry -> {
final String factoryBean = entry.getName() + "_factory";
beanFactory.registerSingleton(factoryBean, (Supplier<Object>) entry::getBean);
beanFactory.registerBeanDefinition(entry.getName(), BeanDefinitionBuilder
.rootBeanDefinition(entry.getBean() != null ? entry.getBean().getClass() : Object.class)
.setFactoryMethodOnBean("get", factoryBean)
.getBeanDefinition());
});
applicationContext.refresh();
return applicationContext;
}
FactoryBeanTests.java 文件源码
项目:spring4-understanding
阅读 23
收藏 0
点赞 0
评论 0
@Test
public void testFactoryBeansWithAutowiring() throws Exception {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(WITH_AUTOWIRING_CONTEXT);
BeanFactoryPostProcessor ppc = (BeanFactoryPostProcessor) factory.getBean("propertyPlaceholderConfigurer");
ppc.postProcessBeanFactory(factory);
assertNull(factory.getType("betaFactory"));
Alpha alpha = (Alpha) factory.getBean("alpha");
Beta beta = (Beta) factory.getBean("beta");
Gamma gamma = (Gamma) factory.getBean("gamma");
Gamma gamma2 = (Gamma) factory.getBean("gammaFactory");
assertSame(beta, alpha.getBeta());
assertSame(gamma, beta.getGamma());
assertSame(gamma2, beta.getGamma());
assertEquals("yourName", beta.getName());
}
SpringServletContext.java 文件源码
项目:graviteeio-access-management
阅读 19
收藏 0
点赞 0
评论 0
protected WebApplicationContext applicationContext() {
if (applicationContext == null) {
AnnotationConfigWebApplicationContext webApplicationContext = new AnnotationConfigWebApplicationContext();
Set<Class<?>> annotatedClasses = annotatedClasses();
if (annotatedClasses != null) {
annotatedClasses.iterator().forEachRemaining(webApplicationContext::register);
}
Set<? extends BeanFactoryPostProcessor> beanFactoryPostProcessors = beanFactoryPostProcessors();
if (beanFactoryPostProcessors != null) {
beanFactoryPostProcessors.iterator().forEachRemaining(webApplicationContext::addBeanFactoryPostProcessor);
}
if (this.rootApplicationContext != null) {
webApplicationContext.setParent(this.rootApplicationContext);
webApplicationContext.setEnvironment((ConfigurableEnvironment) rootApplicationContext.getEnvironment());
}
applicationContext = webApplicationContext;
}
return (WebApplicationContext) applicationContext;
}
JsfScopeAnnotationsAutoConfiguration.java 文件源码
项目:joinfaces
阅读 21
收藏 0
点赞 0
评论 0
@Bean
@ConditionalOnProperty(value = "jsf.scope-configurer.jsf.enabled", havingValue = "true", matchIfMissing = true)
public static BeanFactoryPostProcessor jsfScopeAnnotationsConfigurer(Environment environment) {
CustomScopeAnnotationConfigurer scopeAnnotationConfigurer = new CustomScopeAnnotationConfigurer();
scopeAnnotationConfigurer.setOrder(environment.getProperty("jsf.scope-configurer.jsf.order", Integer.class, Ordered.LOWEST_PRECEDENCE));
scopeAnnotationConfigurer.addMapping(NoneScoped.class, ConfigurableBeanFactory.SCOPE_PROTOTYPE);
scopeAnnotationConfigurer.addMapping(RequestScoped.class, WebApplicationContext.SCOPE_REQUEST);
scopeAnnotationConfigurer.addMapping(javax.faces.bean.ViewScoped.class, ViewScope.SCOPE_VIEW);
scopeAnnotationConfigurer.addMapping(javax.faces.view.ViewScoped.class, ViewScope.SCOPE_VIEW);
scopeAnnotationConfigurer.addMapping(SessionScoped.class, WebApplicationContext.SCOPE_SESSION);
scopeAnnotationConfigurer.addMapping(ApplicationScoped.class, WebApplicationContext.SCOPE_APPLICATION);
return scopeAnnotationConfigurer;
}
ResteasyAutoConfigurationTest.java 文件源码
项目:resteasy-spring-boot
阅读 21
收藏 0
点赞 0
评论 0
private void testServletContextListener(ServletContext servletContext) throws Exception {
ResteasyAutoConfiguration resteasyAutoConfiguration = new ResteasyAutoConfiguration();
BeanFactoryPostProcessor beanFactoryPostProcessor = ResteasyAutoConfiguration.springBeanProcessor();
ServletContextListener servletContextListener = resteasyAutoConfiguration.resteasyBootstrapListener(beanFactoryPostProcessor);
Assert.assertNotNull(servletContextListener);
ServletContextEvent sce = new ServletContextEvent(servletContext);
servletContextListener.contextInitialized(sce);
ResteasyProviderFactory servletContextProviderFactory = (ResteasyProviderFactory) servletContext.getAttribute(ResteasyProviderFactory.class.getName());
Dispatcher servletContextDispatcher = (Dispatcher) servletContext.getAttribute(Dispatcher.class.getName());
Registry servletContextRegistry = (Registry) servletContext.getAttribute(Registry.class.getName());
Assert.assertNotNull(servletContextProviderFactory);
Assert.assertNotNull(servletContextDispatcher);
Assert.assertNotNull(servletContextRegistry);
// Exercising fully cobertura branch coverage
servletContextListener.contextDestroyed(sce);
ServletContextListener servletContextListener2 = resteasyAutoConfiguration.resteasyBootstrapListener(beanFactoryPostProcessor);
servletContextListener2.contextDestroyed(sce);
}
FactoryBeanTests.java 文件源码
项目:class-guard
阅读 20
收藏 0
点赞 0
评论 0
@Test
public void testFactoryBeansWithAutowiring() throws Exception {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(WITH_AUTOWIRING_CONTEXT);
BeanFactoryPostProcessor ppc = (BeanFactoryPostProcessor) factory.getBean("propertyPlaceholderConfigurer");
ppc.postProcessBeanFactory(factory);
Alpha alpha = (Alpha) factory.getBean("alpha");
Beta beta = (Beta) factory.getBean("beta");
Gamma gamma = (Gamma) factory.getBean("gamma");
Gamma gamma2 = (Gamma) factory.getBean("gammaFactory");
assertSame(beta, alpha.getBeta());
assertSame(gamma, beta.getGamma());
assertSame(gamma2, beta.getGamma());
assertEquals("yourName", beta.getName());
}
ContextInstanceDataPropertySourceBeanDefinitionParserTest.java 文件源码
项目:spring-cloud-aws
阅读 21
收藏 0
点赞 0
评论 0
@Test
public void parseInternal_singleElementDefined_beanDefinitionCreated() throws Exception {
//Arrange
HttpServer httpServer = MetaDataServer.setupHttpServer();
HttpContext instanceIdHttpContext = httpServer.createContext("/latest/meta-data/instance-id", new MetaDataServer.HttpResponseWriterHandler("testInstanceId"));
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
//Act
reader.loadBeanDefinitions(new ClassPathResource(getClass().getSimpleName() + "-context.xml", getClass()));
//Assert
BeanFactoryPostProcessor postProcessor = beanFactory.getBean("AmazonEc2InstanceDataPropertySourcePostProcessor", BeanFactoryPostProcessor.class);
assertNotNull(postProcessor);
assertEquals(1, beanFactory.getBeanDefinitionCount());
httpServer.removeContext(instanceIdHttpContext);
}
ProductionPropertyOverrides.java 文件源码
项目:message-cowboy
阅读 21
收藏 0
点赞 0
评论 0
/**
* Overrides properties configured on beans.
*/
@Bean()
@Lazy(false)
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public static BeanFactoryPostProcessor propertyOverrideConfigurer() {
PropertyOverrideConfigurer theOverrideConfigurer = new PropertyOverrideConfigurer();
final Properties thePropertiesHolder = new Properties();
/* Task refresh interval. */
thePropertiesHolder.put("starterService.taskReschedulingCronExpression", "0/20 * * * * ?");
/* Transport service configuration refresh interval. */
thePropertiesHolder.put("starterService.transportServiceConfigurationRefreshCronExpression", "0/30 * * * * ?");
/* Task execution status reports cleanup interval. */
thePropertiesHolder.put("starterService.taskExecutionStatusCleanupCronExpression", "0/30 0/15 * * * ?");
theOverrideConfigurer.setProperties(thePropertiesHolder);
theOverrideConfigurer.setIgnoreInvalidKeys(false);
theOverrideConfigurer.setIgnoreResourceNotFound(false);
theOverrideConfigurer.setOrder(0);
return theOverrideConfigurer;
}
TaskExecutionStatusCleanupTestConfiguration.java 文件源码
项目:message-cowboy
阅读 24
收藏 0
点赞 0
评论 0
/**
* Overrides properties configured on beans.
*/
@Bean()
@Lazy(false)
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public static BeanFactoryPostProcessor propertyOverrideConfigurer() {
PropertyOverrideConfigurer theOverrideConfigurer = new PropertyOverrideConfigurer();
final Properties thePropertiesHolder = new Properties();
/* Task refresh interval. */
thePropertiesHolder.put("starterService.taskReschedulingCronExpression", "* 4/30 * * * ?");
/* Transport service configuration refresh interval. */
thePropertiesHolder.put("starterService.transportServiceConfigurationRefreshCronExpression", "* 5/30 * * * ?");
/* Task execution status reports cleanup interval. */
thePropertiesHolder.put("starterService.taskExecutionStatusCleanupCronExpression", "0/5 * * * * ?");
theOverrideConfigurer.setProperties(thePropertiesHolder);
theOverrideConfigurer.setIgnoreInvalidKeys(false);
theOverrideConfigurer.setIgnoreResourceNotFound(false);
theOverrideConfigurer.setOrder(0);
return theOverrideConfigurer;
}
BlueprintContainerProcessor.java 文件源码
项目:gemini.blueprint
阅读 20
收藏 0
点赞 0
评论 0
public BlueprintContainerProcessor(EventAdminDispatcher dispatcher, BlueprintListenerManager listenerManager,
Bundle extenderBundle) {
this.dispatcher = dispatcher;
this.listenerManager = listenerManager;
this.extenderBundle = extenderBundle;
Class<?> processorClass =
ClassUtils.resolveClassName(
"org.eclipse.gemini.blueprint.blueprint.container.support.internal.config.CycleOrderingProcessor",
BundleContextAware.class.getClassLoader());
cycleBreaker = (BeanFactoryPostProcessor) BeanUtils.instantiate(processorClass);
}
AbstractDelegatedExecutionApplicationContext.java 文件源码
项目:gemini.blueprint
阅读 25
收藏 0
点赞 0
评论 0
/**
* Invoke the given BeanFactoryPostProcessor beans.
*/
private static void invokeBeanFactoryPostProcessors(
Collection<? extends BeanFactoryPostProcessor> postProcessors, ConfigurableListableBeanFactory beanFactory) {
for (BeanFactoryPostProcessor postProcessor : postProcessors) {
postProcessor.postProcessBeanFactory(beanFactory);
}
}
ComponentSubElementTest.java 文件源码
项目:gemini.blueprint
阅读 18
收藏 0
点赞 0
评论 0
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);
}
PostProcessorRegistrationDelegate.java 文件源码
项目:lams
阅读 27
收藏 0
点赞 0
评论 0
/**
* Invoke the given BeanFactoryPostProcessor beans.
*/
private static void invokeBeanFactoryPostProcessors(
Collection<? extends BeanFactoryPostProcessor> postProcessors, ConfigurableListableBeanFactory beanFactory) {
for (BeanFactoryPostProcessor postProcessor : postProcessors) {
postProcessor.postProcessBeanFactory(beanFactory);
}
}
PostProcessorRegistrationDelegate.java 文件源码
项目:spring4-understanding
阅读 20
收藏 0
点赞 0
评论 0
/**
* Invoke the given BeanFactoryPostProcessor beans.
*/
private static void invokeBeanFactoryPostProcessors(
Collection<? extends BeanFactoryPostProcessor> postProcessors, ConfigurableListableBeanFactory beanFactory) {
for (BeanFactoryPostProcessor postProcessor : postProcessors) {
postProcessor.postProcessBeanFactory(beanFactory);
}
}
ConfigurationClassProcessingTests.java 文件源码
项目:spring4-understanding
阅读 25
收藏 0
点赞 0
评论 0
public BeanFactoryPostProcessor beanFactoryPostProcessor() {
return new BeanFactoryPostProcessor() {
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
BeanDefinition bd = beanFactory.getBeanDefinition("beanPostProcessor");
bd.getPropertyValues().addPropertyValue("nameSuffix", "-processed-" + myProp);
}
};
}
ConfigurationClassAndBFPPTests.java 文件源码
项目:spring4-understanding
阅读 25
收藏 0
点赞 0
评论 0
@Bean
public BeanFactoryPostProcessor bfpp() {
return new BeanFactoryPostProcessor() {
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
// no-op
}
};
}
ConfigurationClassAndBFPPTests.java 文件源码
项目:spring4-understanding
阅读 21
收藏 0
点赞 0
评论 0
@Bean
public static final BeanFactoryPostProcessor bfpp() {
return new BeanFactoryPostProcessor() {
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
// no-op
}
};
}
FactoryBeanTests.java 文件源码
项目:spring4-understanding
阅读 23
收藏 0
点赞 0
评论 0
@Test
public void testFactoryBeansWithIntermediateFactoryBeanAutowiringFailure() throws Exception {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(WITH_AUTOWIRING_CONTEXT);
BeanFactoryPostProcessor ppc = (BeanFactoryPostProcessor) factory.getBean("propertyPlaceholderConfigurer");
ppc.postProcessBeanFactory(factory);
Beta beta = (Beta) factory.getBean("beta");
Alpha alpha = (Alpha) factory.getBean("alpha");
Gamma gamma = (Gamma) factory.getBean("gamma");
assertSame(beta, alpha.getBeta());
assertSame(gamma, beta.getGamma());
}
PostProcessorRegistrationDelegate.java 文件源码
项目:my-spring-cache-redis
阅读 24
收藏 0
点赞 0
评论 0
/**
* Invoke the given BeanFactoryPostProcessor beans.
*/
private static void invokeBeanFactoryPostProcessors(
Collection<? extends BeanFactoryPostProcessor> postProcessors, ConfigurableListableBeanFactory beanFactory) {
for (BeanFactoryPostProcessor postProcessor : postProcessors) {
postProcessor.postProcessBeanFactory(beanFactory);
}
}
CdiScopeAnnotationsAutoConfiguration.java 文件源码
项目:joinfaces
阅读 22
收藏 0
点赞 0
评论 0
@Bean
@ConditionalOnProperty(value = "jsf.scope-configurer.cdi.enabled", havingValue = "true", matchIfMissing = true)
public static BeanFactoryPostProcessor cdiScopeAnnotationsConfigurer(Environment environment) {
CustomScopeAnnotationConfigurer scopeAnnotationConfigurer = new CustomScopeAnnotationConfigurer();
scopeAnnotationConfigurer.setOrder(environment.getProperty("jsf.scope-configurer.cdi.order", Integer.class, Ordered.LOWEST_PRECEDENCE));
scopeAnnotationConfigurer.addMapping(RequestScoped.class, WebApplicationContext.SCOPE_REQUEST);
scopeAnnotationConfigurer.addMapping(SessionScoped.class, WebApplicationContext.SCOPE_SESSION);
scopeAnnotationConfigurer.addMapping(ConversationScoped.class, WebApplicationContext.SCOPE_SESSION);
scopeAnnotationConfigurer.addMapping(ApplicationScoped.class, WebApplicationContext.SCOPE_APPLICATION);
return scopeAnnotationConfigurer;
}
ViewScopeAutoConfigurationTest.java 文件源码
项目:joinfaces
阅读 18
收藏 0
点赞 0
评论 0
@Test
public void testRegisteredScopeView() {
ConfigurableListableBeanFactory beanFactory = new DefaultListableBeanFactory();
BeanFactoryPostProcessor beanFactoryPostProcessor = ViewScopeAutoConfiguration.viewScopeConfigurer();
beanFactoryPostProcessor.postProcessBeanFactory(beanFactory);
assertThat(beanFactory.getRegisteredScope(ViewScope.SCOPE_VIEW))
.isInstanceOf(ViewScope.class);
}
PostProcessorRegistrationDelegate.java 文件源码
项目:spring
阅读 40
收藏 0
点赞 0
评论 0
/**
* Invoke the given BeanFactoryPostProcessor beans.
*/
private static void invokeBeanFactoryPostProcessors(
Collection<? extends BeanFactoryPostProcessor> postProcessors, ConfigurableListableBeanFactory beanFactory) {
for (BeanFactoryPostProcessor postProcessor : postProcessors) {
postProcessor.postProcessBeanFactory(beanFactory);
}
}
ExtractorsTest.java 文件源码
项目:dxa-modules
阅读 19
收藏 0
点赞 0
评论 0
@Bean
public BeanFactoryPostProcessor beanFactoryPostProcessor() {
return new BeanFactoryPostProcessor() {
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
doMapping("os.model", "", mockProcessor("Windows"), beanFactory);
doMapping("browser.model", "", mockProcessor("Chrome"), beanFactory);
doMapping("browser.type", "", mockProcessor("Desktop"), beanFactory);
doMapping("browser.version", "", mockProcessor(49), beanFactory);
}
};
}
SchemaServerConfiguration.java 文件源码
项目:spring-cloud-stream
阅读 21
收藏 0
点赞 0
评论 0
@Bean
public static BeanFactoryPostProcessor entityScanPackagesPostProcessor() {
return new BeanFactoryPostProcessor() {
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
if (beanFactory instanceof BeanDefinitionRegistry) {
EntityScanPackages.register((BeanDefinitionRegistry) beanFactory,
Collections.singletonList(Schema.class.getPackage().getName()));
}
}
};
}
SakaiApplicationContext.java 文件源码
项目:sakai
阅读 16
收藏 0
点赞 0
评论 0
/**
* Add bean-created post processors.
* @param beanFactory
*/
public void invokePostProcessorCreators(ConfigurableListableBeanFactory beanFactory) {
String[] postProcessorCreatorNames = beanFactory.getBeanNamesForType(BeanFactoryPostProcessorCreator.class, false, false);
for (int i = 0; i < postProcessorCreatorNames.length; i++) {
BeanFactoryPostProcessorCreator postProcessorCreator = (BeanFactoryPostProcessorCreator)beanFactory.getBean(postProcessorCreatorNames[i]);
for (BeanFactoryPostProcessor beanFactoryPostProcessor : postProcessorCreator.getBeanFactoryPostProcessors()) {
addBeanFactoryPostProcessor(beanFactoryPostProcessor);
}
}
}