我正在使用Spring Boot,并将@PostConstrcut注释添加到我的JPA实体中(如图所示),但是当实体被实例化时,此拦截器永远不会被调用。@PostConstruct JPA实体未在Spring Boot中调用
@Entity
public class MyTableName implements java.io.Serializable {
// all attributes
@PostConstruct
public void init(){
// This code never called
System.out.println("PostConstruct");
}
}
我没有显示此类中的所有代码,但是此实体具有其他具有@Transient注释(我不会持久化的属性)的属性,并且我希望在此实体实例化后为这些属性添加值。 –