-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Closed
Copy link
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
Thomas Darimont opened SPR-12898 and commented
If a user declares multiple CacheManager's without declaring one of them as @Primary and without using a CacheResolver the following Exception is thrown during bootstrap:
java.lang.IllegalStateException: No CacheResolver specified, and no unique bean of type CacheManager found. Mark one as primary or declare a specific CacheManager to use.
In the linked example gist I had two CacheManager's and a Service with two operations where each operation was explicitly referring to a CacheManager. So from looking at the code it seemed that everything was setup correctly.
We should enhance the exception message to make clear that a CacheManager needs to be the "default" one in case no additional configuration is present etc.
How about:
No CacheResolver specified, and no unique bean of type CacheManager found. Mark one as primary (or give it the name cacheManager) or declare a specific CacheManager to use, that serves as the default one.
Affects: 4.1.6
Reference URL: https://gist.github.com/thomasdarimont/b855ae97708d4d8c3c1f
Referenced from: commits e5b5052
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement