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

[ISSUE] spring-boot-caching-2 twolevelcache bean overriden issue #18179

Open
olegs1993 opened this issue Jan 15, 2025 · 3 comments
Open

[ISSUE] spring-boot-caching-2 twolevelcache bean overriden issue #18179

olegs1993 opened this issue Jan 15, 2025 · 3 comments
Labels
triaged Issues reviewed by a dev and considered valid. Will be added in Jira.

Comments

@olegs1993
Copy link

hello, just a quick question

In the task spring-boot-caching-2 twolevelcache the property spring.main.allow-bean-definition-overriding=true is used.

Is there any possibility to customise without that annotation?

@ulisseslima
Copy link
Collaborator

Hey, @olegs1993.

We usually bundle a few articles in the same module. Since this specific configuration isn't mentioned in this article, it probably has no relation to the cache configuration.

It's mentioned here.

Hope that helps.

@olegs1993
Copy link
Author

olegs1993 commented Jan 17, 2025

@ulisseslima could you reopen the issue please. actually it has, as you are creating a bean interceptor that is automatically created by spring. Even in your tutorial, if you clone, change this property to false and run TwoLevelCacheApplication (not tests, looks like something wrong with them), it will fail:

The bean 'cacheInterceptor', defined in class path resource [com/baeldung/caching/twolevelcache/CacheConfig.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/cache/annotation/ProxyCachingConfiguration.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

@ulisseslima
Copy link
Collaborator

@olegs1993 thanks for the additional feedback.

So this configuration is affecting both articles:

This issue will remain open while we look into this.

@ulisseslima ulisseslima reopened this Jan 20, 2025
@ulisseslima ulisseslima added the triaged Issues reviewed by a dev and considered valid. Will be added in Jira. label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issues reviewed by a dev and considered valid. Will be added in Jira.
Projects
None yet
Development

No branches or pull requests

2 participants