I have created a class which implements two interfaces.
I have used a init method with @postconstruction annotation
I am observing that though bean is initialised only during start up, init method is called multiple times.
I have created a class which implements two interfaces.
I have used a init method with @postconstruction annotation
I am observing that though bean is initialised only during start up, init method is called multiple times.
The @PostConstruct method will be called every time the bean is instantiated. This means either every time you do a "new", or, if you've registered your class with a @Service, @Repository, or any other anotation of sorts that registers the class as a spring bean, the first time you @Autowired it.
Watch out for instantations of the class aside from those if you are using another framework annotations like @ManagedBean in JSF, which could be instantiating your class without you realising it.