-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Support @Cache* as merged composed annotations [SPR-13475] #18054
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
Comments
Stéphane Nicoll commented Can you share a project that reproduces the problem because we have tests for that stuff. Composable annotations may not work indeed but meta-annotations should. |
Stéphane Nicoll commented Alright, scratch that. The merging thing isn't tested. I'll look at that in time for |
Nicolas Labrot commented If you agree, I can give it a try to a PR. |
Sam Brannen commented Nicolas Labrot, there's no need to create a PR for this, since it's straightforward. Cheers, Sam |
Sam Brannen commented Hi guys, I unfortunately spoke too soon: this is actually not straightforward. The code in question is In other words, even though Spring's caching annotations are not @Retention(RUNTIME)
@Target(METHOD)
@CacheEvict("foo")
public @interface EvictFoo {
@AliasFor(annotation = Cacheable.class, attribute = "key")
String key() default "";
}
@Retention(RUNTIME)
@Target(METHOD)
@CacheEvict("bar")
public @interface EvictBar {
@AliasFor(annotation = Cacheable.class, attribute = "key")
String key() default "";
}
@EvictFoo(key = "#id + 'foo'")
@EvictBar(key = "#id + 'bar'")
public void multipleEvictions(Long id) {} Since In conclusion: supporting Regards, Sam p.s. I have raised #17490 to address the missing functionality. |
Sam Brannen commented FYI: #17490 has now been resolved. |
Sam Brannen commented Completed as described in GitHub commit 59c88eb:
|
Marc Vanbrabant commented Sam Brannen could it be that the refactoring from 59c88eb has broken some |
Nicolas Labrot opened SPR-13475 and commented
Given this composed annotation:
The resulting
@Cacheable
attributes are not merged. Issue seems to come fromSpringCacheAnnotationParser#parseCacheAnnotations
which does not useAnnotatedElementUtils.findMergedAnnotation(*, Cacheable.class);
.Affects: 4.2 GA
Issue Links:
@ResponseStatus
as a merged composed annotation@CrossOrigin
as a merged composed annotation@CacheConfig
(cacheNames) broken when used on interface@AliasFor
@AliasFor
for@JmsListener
attributesReferenced from: commits ea09e57, 59c88eb, 54703bf
1 votes, 7 watchers
The text was updated successfully, but these errors were encountered: