Just tried, for plain spring managed object which is neither servlet, nor filter nor listener, @PostConstruct method gets called only once on Tomcat 7.
Regards, Stevo. On Sun, Feb 27, 2011 at 9:41 PM, Stevo Slavić <ssla...@gmail.com> wrote: > If I understood spec (servlet-3_0-final-spec.pdf) well, this service > is required only for servlets, filters, and listeners (Table 15-1 > Components and Interfaces supporting Annotations and Dependency > Injection, chapter 15, page 179 of specification, page 201 of pdf). > Yevgen, on which beans did you experience this extra behavior from > Tomcat 7? Were they servlets/filters/listeners or some other spring > managed beans? > > Also, shouldn't it be possible for one to turn off this behavior by > specifying metadata-complete=true, in case one doesn't make use of web > fragments and Java EE specified annotation and dependency injection? > > Regards, > Stevo. > > On Fri, Feb 25, 2011 at 10:12 PM, Mark Thomas <ma...@apache.org> wrote: >> On 25/02/2011 21:03, Yevgen Krapiva wrote: >>> Hi. >>> >>> I have a problem deploying Spring based application to Tomcat 6.0.26 / >>> 7.0.0. >>> Some of my beans have @PostConstruct annotated methods. >>> Like: >>> >>> @PostConstruct >>> public void init() { ... } >>> >>> The problem is that these methods called twice - first time by Tomcat >>> annotation processor, >>> second time - by Spring. >>> Is it possible to turn off this behavior in Tomcat as I do not really want >>> to rewrite the application >>> to use xml configuration metadata. >> >> Sorry, Tomcat provides no such mechanism. The behaviour is required by >> the servlet specification. >> >> Mark >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: users-h...@tomcat.apache.org >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org