Skip to content

Commit 0e6abd1

Browse files
committed
Provide more information about using spring.cache.type=none
Closes gh-33694
1 parent 46773dd commit 0e6abd1

File tree

1 file changed

+6
-3
lines changed
  • spring-boot-project/spring-boot-docs/src/docs/asciidoc/io

1 file changed

+6
-3
lines changed

spring-boot-project/spring-boot-docs/src/docs/asciidoc/io/caching.adoc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ If you have not defined a bean of type `CacheManager` or a `CacheResolver` named
4949

5050
Additionally, {spring-boot-for-apache-geode}[Spring Boot for Apache Geode] provides {spring-boot-for-apache-geode-docs}#geode-caching-provider[auto-configuration for using Apache Geode as a cache provider].
5151

52-
TIP: It is also possible to _force_ a particular cache provider by setting the configprop:spring.cache.type[] property.
53-
Use this property if you need to <<io#io.caching.provider.none,disable caching altogether>> in certain environments (such as tests).
52+
TIP: If the `CacheManager` is auto-configured by Spring Boot, it is possible to _force_ a particular cache provider by setting the configprop:spring.cache.type[] property.
53+
Use this property if you need to <<io#io.caching.provider.none,use no-op caches>> in certain environments (such as tests).
5454

5555
TIP: Use the `spring-boot-starter-cache` "`Starter`" to quickly add basic caching dependencies.
5656
The starter brings in `spring-context-support`.
@@ -269,7 +269,10 @@ This is similar to the way the "real" cache providers behave if you use an undec
269269
[[io.caching.provider.none]]
270270
==== None
271271
When `@EnableCaching` is present in your configuration, a suitable cache configuration is expected as well.
272-
If you need to disable caching altogether in certain environments, force the cache type to `none` to use a no-op implementation, as shown in the following example:
272+
If you have a custom `CacheManager`, consider defining it in a separate `@Configuration` class so that you can override it if necessary.
273+
None uses a no-op implementation that is useful in tests, and slice tests use that by default via `@AutoConfigureCache`.
274+
275+
If you need to use a no-op cache rather than the auto-configured cache manager in a certain environment, set the cache type to `none`, as shown in the following example:
273276

274277
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
275278
----

0 commit comments

Comments
 (0)