Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some components trigger BeanPostProcessorChecker warning "is not eligible for getting processed by all BeanPostProcessors" [INT-3640] #7602

Closed
spring-operator opened this issue Feb 13, 2015 · 7 comments
Assignees
Milestone

Comments

@spring-operator
Copy link
Contributor

spring-operator commented Feb 13, 2015

Gabriele Del Prete opened INT-3640 and commented

Using Spring Framwork 4.1.4 + Spring Integration 4.1.2 triggers the warning from BeanPostProcessorChecker about early configuration of bean and their inability to be processed by BeanPostProcessors.

This happens even with a very trivial app consisting only of a inbound stdin adapter, a channel and a poller: add int:annotation-config/ to the context XML and you'll get the warning. Same thing happens using AnnotationConfigApplicationContext and the @EnableIntegration annotation (since both it and the xml directive just defers to IntegrationRegistrar).

I've created a simple project on GitHub to reproduce the problem.

2015-02-13 16:53:35,587 [main] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'integrationGlobalProperties' of type [class org.springframework.beans.factory.config.PropertiesFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-02-13 16:53:35,588 [main] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'integrationGlobalProperties' of type [class java.util.Properties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-02-13 16:53:35,588 [main] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'messageBuilderFactory' of type [class org.springframework.integration.support.DefaultMessageBuilderFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-02-13 16:53:35,651 [main] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean '(inner bean)#406fcc9c' of type [class org.springframework.integration.channel.MessagePublishingErrorHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-02-13 16:53:35,651 [main] INFO o.s.scheduling.concurrent.ThreadPoolTaskScheduler - Initializing ExecutorService 'taskScheduler'
2015-02-13 16:53:35,653 [main] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'taskScheduler' of type [class org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-02-13 16:53:35,653 [main] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'integrationHeaderChannelRegistry' of type [class org.springframework.integration.channel.DefaultHeaderChannelRegistry] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)


Affects: 4.1.2

Reference URL: https://github.com/gdelprete/integrationregistrar-sample

Sub-tasks:

Issue Links:

1 votes, 3 watchers

@spring-operator
Copy link
Contributor Author

Gabriele Del Prete commented

As an additional remark: in a slightly more complicate app using JPA and a transaction manager, the warnings are emitted for transaction-related beans too, which is more scary.

@spring-operator
Copy link
Contributor Author

Artem Bilan commented

Gabriele Del Prete, sorry for not getting you so quickly.

So, what is your concern?
Looks like that warn is just an INFO and when you decrease log level for the org.springframework category it will go away.
Does your application start work wrong?
Do you mean that we should defer usage of that beans? But they are really an internal stuff and represent just an infrastructure and they shouldn't be used for the BeanPostProcessor adjustments.

Sorry, I don't see a bug

@spring-operator
Copy link
Contributor Author

Artem Bilan commented

Regarding JPA and transactionManager:
Do you use Spring Data JPA?
Would you mind to share logs on the matter to figure out how it looks in that case.

And I guess that transaction-related beans isn't related to Spring Integration: you may see that INFO even without SI.

@spring-operator
Copy link
Contributor Author

Gabriele Del Prete commented

No,

just the standard Spring Framwork support for JPA (EntityManagerFactoryBean and the JPA transaction manager, plus Jpa Outbound Adapter I'm building manually as the Java DSL does not give support for that at the moment):

2015-02-17 11:21:58,678 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'com.myapp.web.backend.config.integration.DatabaseConfig' of type [class com.myapp.web.backend.config.integration.DatabaseConfig$$EnhancerBySpringCGLIB$$806af224] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2015-02-17 11:21:58,925 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'dataSource' of type [class org.springframework.jdbc.datasource.SimpleDriverDataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2015-02-17 11:21:58,950 [main] INFO  o.s.orm.jpa.LocalContainerEntityManagerFactoryBean - Building JPA container EntityManagerFactory for persistence unit 'default' 
2015-02-17 11:21:59,451 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'entityManagerFactory' of type [class com.sun.proxy.$Proxy16] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2015-02-17 11:21:59,491 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'jpaAdapter.jpaExecutor' of type [class org.springframework.integration.jpa.core.JpaExecutor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2015-02-17 11:21:59,494 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$bff897e2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2015-02-17 11:21:59,520 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'transactionAttributeSource' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2015-02-17 11:21:59,527 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'transactionInterceptor' of type [class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2015-02-17 11:21:59,531 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2015-02-17 11:21:59,565 [main] INFO  o.springframework.beans.factory.config.PropertiesFactoryBean - Loading properties file from URL [jar:file:/home/gabriele.delprete/.gradle/caches/modules-2/files-2.1/org.springframework.integration/spring-integration-core/4.1.2.RELEASE/e8af369aeee0c788ee6a7109665d4f46cc1332ea/spring-integration-core-4.1.2.RELEASE.jar!/META-INF/spring.integration.default.properties] 
2015-02-17 11:21:59,565 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'integrationGlobalProperties' of type [class org.springframework.beans.factory.config.PropertiesFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2015-02-17 11:21:59,566 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'integrationGlobalProperties' of type [class java.util.Properties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2015-02-17 11:21:59,571 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'messageBuilderFactory' of type [class org.springframework.integration.support.DefaultMessageBuilderFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2015-02-17 11:21:59,670 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean '(inner bean)#6493d8f' of type [class org.springframework.integration.channel.MessagePublishingErrorHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2015-02-17 11:21:59,671 [main] INFO  o.s.scheduling.concurrent.ThreadPoolTaskScheduler - Initializing ExecutorService  'taskScheduler' 
2015-02-17 11:21:59,673 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'taskScheduler' of type [class org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2015-02-17 11:21:59,675 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'integrationHeaderChannelRegistry' of type [class org.springframework.integration.channel.DefaultHeaderChannelRegistry] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 

It looks like the application is working, just wanted to signal that it looks like IntegrationRegistrar is triggering those warnings. You can downgrade or close this issue if you want.

@spring-operator
Copy link
Contributor Author

Artem Bilan commented

Gabriele Del Prete, thank you very much for pointing this!

Even if it is just an INFO from PostProcessorRegistrationDelegate$BeanPostProcessorChecker, it really looks like a bug or at least the wrong usage of Spring Framework.

One of our issues on the matter looks like:

@Override
public final void setBeanFactory(BeanFactory beanFactory) {
	Assert.notNull(beanFactory, "'beanFactory' must not be null");
	this.beanFactory = beanFactory;
	this.integrationProperties = IntegrationContextUtils.getIntegrationProperties(this.beanFactory);
}

The BeanFactoryAware.setBeanFactory is called from AbstractAutowireCapableBeanFactory.initializeBean before applyBeanPostProcessorsAfterInitialization. Since we really may not have all BeanPostProcessors in the application context yet, it is an invalid usage of BeanFactoryAware.setBeanFactory. Especially if we populate additional beans from one of our BeanPostProcessor.

The same we have with ApplicationContextAware because ApplicationContextAwareProcessor is a BeanPostProcessor, too.

I think we really have to investigate our code and get rid of such a wrong usage, but for those JPA and TX issues we need an input from Spring Core team: maybe there we should raise a similar issue, too.

And one more point: since we see that only with our internal beans and they are really designed for the infrastructure I don't see reason to worry very much, because it was here for a long time already and I can't figure out any case how they can be adjusted with some custom BeanPostProcessor, which may not be reached with this our issue. That's why I'm not going to backport it. And I predict some breaking changes if we decide to fix it, of course :) ...

/CC: Juergen Hoeller, Stéphane Nicoll

@spring-operator
Copy link
Contributor Author

Artem Bilan commented

One more progress: I see that issue appears only when we have <int:annotation-config/> and @EnableIntegration, of course.

@spring-operator
Copy link
Contributor Author

Artem Bilan commented

IntegrationRegistrar.registerMessagingAnnotationPostProcessors -> new PublisherRegistrar().registerBeanDefinitions(meta, registry); -> PublisherAnnotationBeanPostProcessor.afterPropertiesSet -> PublisherAnnotationAdvisor.setBeanFactory -> new BeanFactoryChannelResolver(beanFactory) - > lookupHeaderChannelRegistry(beanFactory). Voila! BeanFactory access during BeanPostProcessor initialization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants