SpringBoot 2.1.4.RELEASE不在@Cacheable注释中缓存空值
我有一个SpringBoot 2.1.4.RELEASE应用程序。使用存储库:SpringBoot 2.1.4.RELEASE不在@Cacheable注释中缓存空值,spring,spring-boot,spring-mvc,spring-data-jpa,spring-cache,Spring,Spring Boot,Spring Mvc,Spring Data Jpa,Spring Cache,我有一个SpringBoot 2.1.4.RELEASE应用程序。使用存储库: @Repository public interface PercentageAlertXMenuRepository extends CrudRepository<PercentageAlertXMenu, Long> { @Cacheable("percentageAlertXMenu", unless="#result == null") PercentageAlertXMenu
@Repository
public interface PercentageAlertXMenuRepository extends CrudRepository<PercentageAlertXMenu, Long> {
@Cacheable("percentageAlertXMenu", unless="#result == null")
PercentageAlertXMenu findByPercentageAlertAndMenu (MenuPercentageAlert percentageAlert, Menu Menu);
您需要使用注释的
值属性:
@Cacheable(value="percentageAlertXMenu", unless="#result == null")
@Cacheable(value="percentageAlertXMenu", unless="#result == null")