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

early bean initialization of cache-related beans lead to early creating of the cache manager #8467

Closed
snicoll opened this Issue Mar 2, 2017 · 6 comments

Comments

Projects
None yet
2 participants
@snicoll
Member

snicoll commented Mar 2, 2017

When @EnableCaching is added to a web application, the following occurs:

2017-03-02 14:58:35.470  INFO 38838 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@569cfc36: startup date [Thu Mar 02 14:58:35 CET 2017]; root of context hierarchy
2017-03-02 14:58:36.063  INFO 38838 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration' of type [class org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-03-02 14:58:36.107  INFO 38838 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'validator' of type [class org.springframework.validation.beanvalidation.LocalValidatorFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-03-02 14:58:36.121  INFO 38838 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cache.annotation.ProxyCachingConfiguration' of type [class org.springframework.cache.annotation.ProxyCachingConfiguration$$EnhancerBySpringCGLIB$$f9726f0f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-03-02 14:58:36.125  INFO 38838 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cache.jcache.config.ProxyJCacheConfiguration' of type [class org.springframework.cache.jcache.config.ProxyJCacheConfiguration$$EnhancerBySpringCGLIB$$d2a7fb6f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-03-02 14:58:36.163  INFO 38838 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration' of type [class org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration$$EnhancerBySpringCGLIB$$ede633b3] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-03-02 14:58:36.176  INFO 38838 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.cache-org.springframework.boot.autoconfigure.cache.CacheProperties' of type [class org.springframework.boot.autoconfigure.cache.CacheProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-03-02 14:58:36.181  INFO 38838 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'cacheManagerCustomizers' of type [class org.springframework.boot.autoconfigure.cache.CacheManagerCustomizers] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-03-02 14:58:36.184  INFO 38838 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.cache.JCacheCacheConfiguration' of type [class org.springframework.boot.autoconfigure.cache.JCacheCacheConfiguration$$EnhancerBySpringCGLIB$$7ea9635a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

In a non web app, such early initalization doesn't happen.

@snicoll snicoll added the type: bug label Mar 2, 2017

@snicoll snicoll self-assigned this Mar 2, 2017

@snicoll

This comment has been minimized.

Show comment
Hide comment
@snicoll
Member

snicoll commented Mar 2, 2017

@snicoll

This comment has been minimized.

Show comment
Hide comment
@snicoll

snicoll Mar 2, 2017

Member

So the default bootstrap thing that detects a hazelcast.xml at default locations won't be able to get an instance that was already created. I've created hazelcast/hazelcast#10007 to see if there is something I am missing.

Member

snicoll commented Mar 2, 2017

So the default bootstrap thing that detects a hazelcast.xml at default locations won't be able to get an instance that was already created. I've created hazelcast/hazelcast#10007 to see if there is something I am missing.

@snicoll

This comment has been minimized.

Show comment
Hide comment
@snicoll

snicoll Mar 2, 2017

Member

The early init of those beans happens with a web application. In a standalone app, I don't seem to be able to reproduce the issue.

Member

snicoll commented Mar 2, 2017

The early init of those beans happens with a web application. In a standalone app, I don't seem to be able to reproduce the issue.

@snicoll

This comment has been minimized.

Show comment
Hide comment
@snicoll

snicoll Mar 3, 2017

Member

It looks like the culprit is those two BPP. Not that WebFlux is also affected by this problem since it registers a similar BPP

Member

snicoll commented Mar 3, 2017

It looks like the culprit is those two BPP. Not that WebFlux is also affected by this problem since it registers a similar BPP

snicoll added a commit to snicoll/spring-boot that referenced this issue Mar 3, 2017

Avoid early initializations
This commit flags the two `BeanPostProcessors` registered by the
embedded support as `synthetic` so that they don't trigger an early
initialization of other components.

Closes gh-8467
@snicoll

This comment has been minimized.

Show comment
Hide comment
@snicoll

snicoll Mar 3, 2017

Member

I've moved the cache/hazelcast specific business in #8484

Member

snicoll commented Mar 3, 2017

I've moved the cache/hazelcast specific business in #8484

@snicoll

This comment has been minimized.

Show comment
Hide comment
@snicoll

snicoll Mar 3, 2017

Member

When merging this forward to master ReactiveWebServerCustomizerBeanPostProcessor needs to be updated with the same mechansim as it is affected as well.

Member

snicoll commented Mar 3, 2017

When merging this forward to master ReactiveWebServerCustomizerBeanPostProcessor needs to be updated with the same mechansim as it is affected as well.

@philwebb philwebb added this to the 1.5.3 milestone Mar 3, 2017

@philwebb philwebb modified the milestones: 1.4.6, 1.5.3 Mar 3, 2017

@snicoll snicoll closed this in 9fb9a67 Mar 6, 2017

snicoll added a commit that referenced this issue Mar 6, 2017

Avoid early initializations for reactive support
This commit flags the `BeanPostProcessor` registered by the reactive
embedded support as `synthetic` so that it doesn't trigger an early
initialization of other components.

See gh-8467
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment