Allow custom CacheResolver

Previously, if a bean of type `CacheResolver` was present in the context
the whole cache auto-configuration would back off. If said
`CacheResolver` hasn't been defined via the `CachingConfigurer`
infrastructure, the application context would fail with a rather
unpleasant error message.

It can be quite common to define custom `CacheResolver` beans as the cache
annotations allow to defines custom cache resolvers per operation. This
commit makes sure that the cache auto-configuration will back-off only if
the `CacheResolver` is named `cacheResolver`.

Closes gh-5201
This commit is contained in:
Stephane Nicoll
2016-02-29 15:48:46 +01:00
parent f04b517adb
commit d9f4d6ce91
3 changed files with 38 additions and 19 deletions

View File

@@ -3241,7 +3241,9 @@ TIP: Use the `spring-boot-starter-cache` "`Starter POM`" to quickly add required
dependencies. If you are adding dependencies manually you should note that certain
implementations are only provided by the `spring-context-support` jar.
Spring Boot tries to detect the following providers (in this order):
If you haven't defined a bean of type `CacheManager` or a `CacheResolver` named
`cacheResolver` (see `CachingConfigurer`), Spring Boot tries to detect the following
providers (in this order):
* <<boot-features-caching-provider-generic,Generic>>
* <<boot-features-caching-provider-jcache,JCache (JSR-107)>>