【发布时间】:2016-10-01 02:27:09
【问题描述】:
public interface MyRespository extends CrudRepository<MyEntity, Long> {
@CachePut(value = "mycache", key = "id")
@Override
public <S extends MyEntity> S save(S entity);
}
@Entity
public class MyEntity {
@Id
private Long id;
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
}
结果:
org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): 在 的对象上找不到属性或字段“id” 输入“org.springframework.cache.interceptor.CacheExpressionRootObject” - 也许不公开?
【问题讨论】:
-
试试
#entity.id.. -
org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Property or field 'id' cannot be found on null -
显然你在持久化一个空实体
-
不,我不是。只是
#entity.id无法以某种方式解决。当我删除@CachePut注释时,案例工作正常。
标签: java spring caching spring-cache spelevaluationexception