Skip to content

Correct invalid @CacheConfig snippet in documentation #35096

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Junnyjun
Copy link

Original example used @CacheConfig("books"), which leads to a runtime error because the annotation requires cacheNames to be explicitly defined.
This PR updates the annotation to @CacheConfig(cacheNames = "books") for correctness.

Signed-off-by: Junnyjun <chbe5082@naver.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 22, 2025
@rstoyanchev rstoyanchev added type: documentation A documentation task in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jul 3, 2025
@rstoyanchev rstoyanchev added this to the 6.2.9 milestone Jul 3, 2025
@rstoyanchev rstoyanchev added type: task A general task and removed type: documentation A documentation task labels Jul 3, 2025
@rstoyanchev rstoyanchev changed the title fix: correct invalid usage of @CacheConfig Correct invalid @CacheConfig snippet in documentation Jul 3, 2025
@rstoyanchev rstoyanchev self-assigned this Jul 3, 2025
@sbrannen
Copy link
Member

sbrannen commented Jul 3, 2025

Good catch, @Junnyjun. 👍

The documentation is certainly incorrect, though in all fairness, the rest of the cache-related annotations such as @Cacheable, @CachePut, etc., all have aliased value attributes for the cacheNames.

So, I assume:

  1. That was an oversight.
  2. The documentation was written under the assumption that all cache-related annotations had a value attribute that aliases cacheNames.

@sbrannen
Copy link
Member

sbrannen commented Jul 3, 2025

the rest of the cache-related annotations such as @Cacheable, @CachePut, etc., all have aliased value attributes for the cacheNames.

To address that, I've add a value attribute in 7.0.

sbrannen added a commit that referenced this pull request Jul 3, 2025
Prior to this commit @⁠CacheConfig did not have a `value` attribute
alias for `cacheNames`, even though the rest of the cache-related
annotations (such as @⁠Cacheable, @⁠CachePut, etc.) do have a `value` /
`cacheNames` alias pair.

To address that inconsistency, this commit introduces a `value` alias
for `cacheNames` in @⁠CacheConfig as well.

See gh-35096
Closes gh-35152
@Junnyjun
Copy link
Author

Junnyjun commented Jul 3, 2025

Hello @sbrannen,

Thank you for your detailed explanation regarding the cacheNames attribute in @CacheConfig and related caching annotations.

also appreciate you creating and completing PR #35152 to address this issue more fundamentally by introducing value alias for cacheNames in @CacheConfig.

this Pull Request (#35096) is no longer necessary, as the core problem will be resolved by PR #35152, so will proceed to close this PR.

@Junnyjun Junnyjun closed this Jul 3, 2025
@Junnyjun Junnyjun deleted the fix-cacheconfig-description branch July 3, 2025 17:00
@sbrannen
Copy link
Member

sbrannen commented Jul 3, 2025

Hi @Junnyjun,

We still plan to fix the broken documentation example for 6.2.x.

However, I see that you already closed this PR and removed your branch.

Would you like to try to reopen this PR (or create a new one)?

If not, just let us know, and we'll make the change on 6.2.x for you.

Thanks,

Sam

@Junnyjun Junnyjun restored the fix-cacheconfig-description branch July 3, 2025 17:22
@sbrannen
Copy link
Member

sbrannen commented Jul 3, 2025

Reopening to address the documentation issue in 6.2.x.

@sbrannen sbrannen reopened this Jul 3, 2025
@Junnyjun
Copy link
Author

Junnyjun commented Jul 3, 2025

I accidentally deleted branch it by pressing the wrong button, but I quickly recovered it

@Junnyjun
Copy link
Author

Junnyjun commented Jul 3, 2025

The PR has been reopened 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants