@Cacheable unless的写法,绕不开的SpEL

List对象

unless = "#result==null or #result.size()==0"

unless = "#result==null or #result.isEmpty()"

 

普通对象,就够了

unless = "#result==null"

 

https://stackoverflow.com/questions/25977710/spring-cacheable-filter-out-empty-collections-using-spel

More about result and or.

 

 

https://docs.spring.io/spring-framework/docs/current/reference/html/core.html#expressions-operators-logical

 

posted @ 2022-09-01 09:54  multitude  阅读(1499)  评论(0)    收藏  举报