开发者

How does init() get called on a Handler in a WebApp

开发者 https://www.devze.com 2022-12-30 13:20 出处:网络
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 doe

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 i开发者_JAVA技巧nvoked? Is it via Spring or does Tomcat call this?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消