You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Yevgen Krapiva <yk...@gmail.com> on 2011/02/25 22:03:50 UTC

How to disable JSR 250 annotations processor ?

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.

I've written in the topic - JSR 250, but to be honest, I didn't test it with
the other annotations from
that JSR.

Thanks.

Re: How to disable JSR 250 annotations processor ?

Posted by Stevo Slavić <ss...@gmail.com>.
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ć <ss...@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-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to disable JSR 250 annotations processor ?

Posted by Stevo Slavić <ss...@gmail.com>.
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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to disable JSR 250 annotations processor ?

Posted by Mark Thomas <ma...@apache.org>.
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org