且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Spring Boot - 如何在开发期间禁用@Cachable?

更新时间:2022-06-19 22:21:50

默认情况下会自动检测缓存的类型,配置。但是,您可以通过将 spring.cache.type 添加到配置中来指定要使用的缓存类型。要禁用它,请将值设置为 NONE

The type of cache is by default automatically detected and configured. However you can specify which cache type to use by adding spring.cache.type to your configuration. To disable it set the value to NONE.

如果您想为特定的配置文件执行此操作,请将其添加到该配置文件 application.properties 在这种情况下修改 application-dev.properties 并添加

As you want to do it for a specific profile add it to that profiles application.properties in this case modify the application-dev.properties and add

spring.cache.type=NONE

这将禁用缓存。