On Nov 21, 2008, at 8:49 PM, Gili wrote:
>
>
> Paul Sandoz wrote:
>>
>> IoCInstantiatedComponentProvider should be used when the IoC
>> component
>> provider instantiates but Jersey manages in terms of life-cycle and
>> should be annotated with Jersey life-cycle annotations.
>>
>
> I'm not clear on how that could happen. Can you provide a code
> sniplet that
> demonstrates this?
>
See the com.sun.jersey.spi.spring.container.SpringComponentProvider
(and the snippets of code at end of email).
It is used for Spring 2.0.x when there is no annotation-based
autowiring capability and we can emulate that with a Jersey specific
annotation.
I suspect that for most cases IoCInstantiatedComponentProvider is
unlikely to be used and the managed provider is of most interest.
Paul.
final Autowire autowire =
(Autowire)c.getAnnotation(Autowire.class);
if (autowire != null) {
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.finest("Creating resource class " +
c.getSimpleName() +
" annotated with @" +
Autowire.class.getSimpleName() +
" as spring bean.");
}
return new SpringInstantiatedComponentProvider(c,
autowire);
}
private class SpringInstantiatedComponentProvider implements
IoCInstantiatedComponentProvider {
private final Class c;
private final Autowire a;
SpringInstantiatedComponentProvider(Class c, Autowire a) {
this.c = c;
this.a = a;
}
public Object getInstance() {
return springContext.getBeanFactory().createBean(c,
a.mode().getSpringCode(), a.dependencyCheck());
}
public Object getInjectableInstance(Object o) {
return
SpringComponentProviderFactory.getInjectableInstance(o);
}
}
> Gili
> --
> View this message in context: http://n2.nabble.com/Simplifying-Jersey-life-cycle-and-IoC-integration-tp1367641p1563239.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>