Skip to content

CacheAutoConfiguration triggers early initialization of cache components #13038

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

Closed
snicoll opened this issue May 3, 2018 · 4 comments
Closed
Assignees
Labels
type: bug A general bug
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented May 3, 2018

While working on a feature to demonstrate how to swap a CacheManager in a BPP, I found that the cache auto-configuration was triggering early initializations.

This basically boil down to CacheManagerValidator whose purpose is to throw an exception "early enough" if no CacheManager could be auto-configured. Removing that locally was enough to fix the problem

@snicoll snicoll added the type: bug A general bug label May 3, 2018
@snicoll snicoll added this to the 1.5.x milestone May 3, 2018
@snicoll snicoll self-assigned this May 3, 2018
snicoll added a commit to snicoll/spring-boot that referenced this issue May 3, 2018
This commit restructures the Cache auto-configuration to avoid an early
init on CacheManager (and potentially all its infrastructure). Rather
than adding a dependency on the validator bean, this commit relies on
the fact CacheAspectSupport checks if a CacheManager is available in the
afterSingletonsInstantiated callback. In this case, a simple bean with
a postconstruct callback is enough.

Closes spring-projectsgh-13038
@snicoll snicoll modified the milestones: 1.5.x, 1.5.13 May 4, 2018
@snicoll snicoll closed this as completed in 1314aaa May 4, 2018
@jtktam
Copy link

jtktam commented Jun 12, 2018

Hi, has this fix been merged to 2.0.2.RELEASE? thanks

@snicoll
Copy link
Member Author

snicoll commented Jun 12, 2018

@jtktam if you click on the link above your comment, it states in which tags the fix is included. Yes, it's included (we always merge forward so whatever is in 1.5 is in 2.0 and will be in 2.1).

@jtktam
Copy link

jtktam commented Jun 12, 2018

I think I am still running into the early initialization bug in 2.0.2.RELEASE, that's why i wanted to confirm it's merged forward

@snicoll
Copy link
Member Author

snicoll commented Jun 12, 2018

@jtktam we don't use the tracker for questions (see the guidelines for contributing). Feel free to come chat with us on Gitter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants