The configuration to cache empty results was configured in application.yml, but it still crashed while testing the cache breakdown!Under normal circumstances, if the empty result is cached in application. yml and the data that is not in the database is accessed, it can still be written into the cache, but I reported an error, which makes me unable to understand. I hope eldest brother help me answer, thank you!
The following configuration is for empty cache results
cache: type: redis redis: cache-null-values: true
The following is an error message
Creating a new SqlSessionSqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@77bf52e5] was not registered for synchronization because synchronization is not active2023-01-13 09:34:37.065 INFO 22496 --- [nio-8080-exec-2] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...2023-01-13 09:34:37.132 INFO 22496 --- [nio-8080-exec-2] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.JDBC Connection [HikariProxyConnection@1956281659 wrapping com.mysql.cj.jdbc.ConnectionImpl@5d790055] will not be managed by Spring==> Preparing: SELECT id,title,cover_img,detail,amount,stock,create_time FROM product WHERE id=?==> Parameters: 6(Integer)<== Total: 0Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@77bf52e5]2023-01-13 09:34:37.176 ERROR 22496 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Cache 'product' does not allow 'null' values. Avoid storing null via '@Cacheable(unless="#result == null")' or configure RedisCache to allow 'null' via RedisCacheConfiguration.] with root causejava.lang.IllegalArgumentException: Cache 'product' does not allow 'null' values. Avoid storing null via '@Cacheable(unless="#result == null")' or configure RedisCache to allow 'null' via RedisCacheConfiguration.