Annotation Type PostConstruct


The PostConstruct annotation is used on a method that needs to be executed after dependency injection is done to perform any initialization.

Note that we can equally use any PostConstruct annotation - so we can use the one from javax.annotation, jakarta.annotation or this one.

Only one method in a given class can be annotated with this annotation.

The method on which the PostConstruct annotation is applied must fulfill the following criteria:

  • The method must not have any parameters.
  • The method may be public, protected or package private.
  • The method must not be static.