开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜