users@jersey.java.net

Re: IoC-integration: injection based on annotation implemented (spring-integration branch)

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 14 Apr 2008 09:11:13 +0200

On Apr 12, 2008, at 2:55 PM, Martin Grotzke wrote:

> Hi,
>
> the spring-integration branch now supports annotation based injection.
>
> There's one annotation defined by jersey, that pulls instances from
> the
> component provider: @Inject. So it's possible to have a resource class
> that is managed by jersey with dependencies managed by some
> IoC-framework.

Great, i will take a closer look this week.


> @Paul: I defined the @Inject annotation in the package
> "com.sun.ws.rest.spi.resource". Is this ok, or is there a better place
> for it?
>

Yes. Actually at some point (after merging perhaps) we need to move
some of the classes in here to:

   com.sun.ws.rest.api.resource

namely:

   PerRequest, Singleton, and now Inject

as these classes are really for end developers.

Paul.

> Additionally it's possible to add an injectable per annotation to the
> WebApplication, so one could create its own @DAO annotation :)
>
> These tests show and test both use scenarios:
> - com.sun.ws.rest.impl.inject.AnnotationInjectableTest
> - com.sun.ws.rest.impl.inject.InjectAnnotationInjectableTest
>
> The spring subproject in the spring-integration branch now contains
> tests (still some missing) - these tests make also use of the inject
> annotation.
>
> When I find some time I will add some notes about spring
> integration to
> the wiki...
>
> Cheers,
> Martin
>
>