-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Open
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug
Milestone
Description
Overview
When static methods are used for cache key creation and 2 static methods have the same signature in a class inheritance hierarchy, then only one static method is used for cache key generation. I created a small example project: https://github.com/fibsifan/spring-cache-error
The most relevant part is in the Controller:
@Cacheable(cacheNames = "cachedController", key = "T(de.jball.spring.caching.keys.ParentCacheKeyGenerator).getCacheKey()")
@GetMapping("parent")
public String getResponseWithParentCacheKey() {
return "ResponseWithParentCacheKey";
}
@Cacheable(cacheNames = "cachedController", key = "T(de.jball.spring.caching.keys.ChildCacheKeyGenerator).getCacheKey()")
@GetMapping("child")
public String getResponseWithChildCacheKey() {
return "ResponseWithChildCacheKey";
}If GET http://localhost:8080/parent is called first, then calls to /child always return ResponseWithParentCacheKey and vice versa.
Related Issues
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug