我正在使用 Spring Boot 并且我在我的 JPA 实体中添加了 @PostConstrcut 注释,如图所示,但是当实体被实例化时,这个拦截器永远不会被调用。
@Entity
public class MyTableName implements java.io.Serializable {
// all attributes
@PostConstruct
public void init(){
// This code never called
System.out.println("PostConstruct");
}
}
Run Code Online (Sandbox Code Playgroud)