I'm using Spring Boot and I added @PostConstrcut annotation to my JPA Entity as shown , but When the entity is instantiated this interceptor is never called .
@Entity
public class MyTableName implements java.io.Serializable {
// all attributes
@PostConstruct
public void init(){
// This code never called
System.out.println("PostConstruct");
}
}
I found the solution, in fact, instead of using the @PostConstruct annotation (managed by container) , I used @PostLoad (managed by ORM). Thank you.