Hi Martin, Jens,
Could things be related to the following issue:
https://jersey.dev.java.net/issues/show_bug.cgi?id=222
Martin, the patch supplied with the issue looks good, but if you have
time could you look at it, also any hints help on writing unit tests
for it would be most helpful.
Paul.
On Mar 4, 2009, at 11:06 PM, Martin Grotzke wrote:
> Hi,
>
> I just modified the spring-annotations sample to use a custom
> SpringServiceApplicationContext that inherits from
> XmlWebApplicationContext, as you described. I also added a resource
> class with a field annotated with @Inject, of a type that has a bean
> definition in the applicationContext.
>
> The SpringServiceApplicationContext is created and getBean(String
> name,
> Class requiredType) method is invoked as expected. So I can't
> reproduce
> your issue.
>
> The spring-annotations sample is using the spring
> ContextLoaderListener
> and the jersey SpringServlet as a servlet.
>
> What's your setup? Can you provide more code to reproduce?
>
> Cheers,
> Martin
>
>
> On Wed, 2009-03-04 at 12:08 +0100, mailinglist_at_j-b-s.de wrote:
>> Hi!
>>
>> I am new to Jersey and got a problem concerning "@Inject" of spring
>> beans in my Jersey sample app. We use our own Web app context class
>> which is directly derived from Springs XmlWebApplicationContext.
>> When the application starts the context gets properly initialized
>> so it is not a problem of the web.xml (well, it looks like not to
>> be :-).
>> ...
>> <context-param>
>> <param-name>contextClass</param-name>
>> <param-value>testpackage.SpringServiceApplicationContext</param-
>> value>
>> </context-param>
>> ...
>> so using this entry in web.xml the spring context is initialized.
>>
>>
>> Unfortunately no call from Jersey to one of the getBean methods
>> happens, so it seems the @Inject is silently ignored. Can anyone
>> give me a litte hint or point my in the right direction? Is there a
>> special prop/setting where I can tell jersey to map "@inject" to
>> "please use the SpringServiceApplicationContext" to retrieve the
>> beans?
>>
>>
>> Thanks in advance
>>
>> Jens
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
> --
> Martin Grotzke
> http://www.javakaffee.de/blog/