Question

I have a Handler object that functions kind of like a service. It has a public init method defined in the Implementation but not the Interface. This Handler is also being autowired via Spring. How does the init method get invoked? Is it via Spring or does Tomcat call this?

Was it helpful?

Solution

If it's spring, an init-method attribute should do the trick. Similarly, one can implement the InitializingBean#afterPropertiesSet method in which the init could be invoked.

If you don't see an init-method attribute being specified for your bean declaration in spring, look for a default-init-method="init" attribute declaration in the root tag, beans.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top