What is the method to disable caching in Spring Boot JPA?

In Spring Boot, you can disable JPA caching by setting the spring.jpa.properties.hibernate.cache.use_second_level_cache property to false. You can add the following configuration in the application.properties file.

spring.jpa.properties.hibernate.cache.use_second_level_cache=false

Disabling the second-level cache of JPA can be achieved by setting the spring.jpa.properties.hibernate.cache.use_query_cache property to false. Please note that in some cases, you may also need to disable the first-level cache.

spring.jpa.properties.hibernate.cache.use_query_cache=false

After completing the above configuration, the JPA cache will be disabled.

bannerAds