users@jersey.java.net

Re: [Jersey] Injectable providers

From: Comerford, Sean <Sean.Comerford_at_espn3.com>
Date: Fri, 4 Dec 2009 17:52:13 +0000

Ahhh, GF v3!

I did see that example and couldn't figure out why I couldn't seem to get
that working.

But I was using 2.1.1 and thought maybe the Jersey adaptor servlet had some
magic in it that made the injectable stuff work but it sounds like EE 6 is
the "magic".

Thanks Pavel... I'll switch to v3 and try this.

On 12/4/09 12:27 PM, "Pavel Bucek" <Pavel.Bucek_at_Sun.COM> wrote:

> Hi Sean,
>
> take a look at bookmark-em sample:
> https://jersey.dev.java.net/source/browse/jersey/trunk/jersey/samples/bookmark
> -em/
> or
> http://download.java.net/maven/2/com/sun/jersey/samples/bookmark-em/1.1.5-ea-S
> NAPSHOT/bookmark-em-1.1.5-ea-SNAPSHOT-gf-project.zip
>
> With latest Jersey and recent GFv3 build is possible to inject
> EntityManager to Managed bean, so you can have something like:
>
> @Path("/users/")
> @ManagedBean
> public class UsersResource {
>
> // injected EntityManager property
> @PersistenceContext(unitName="BookmarkPU")
> private EntityManager em;
> ...
> }
>
> Regards,
> Pavel
>
> Comerford, Sean wrote:
>> After getting side tracked for awhile, I¹m starting to look heavily at
>> Jersey again.
>>
>> Awhile back I had asked about having JPA EntityManager¹s injected into
>> my resources.
>>
>> Paul explained that this sort of thing wouldn¹t be available until
>> Java EE 6 time frame but that one potential interim solution was to
>> use Jerey¹s CloseableService.
>>
>> Can Paul or anyone else point me to more information on this?
>>
>> Currently I¹ve more or less rigged up my on framework (and I use that
>> term loosely here :-) for injecting the em or emf into my resources
>> but am looking for a more standardized method.
>>
>> Would like to avoid introducing Spring - too many frameworks we don¹t
>> currently use in the mix already plus it seems like overkill for what
>> I¹m looking to do :-)
>>
>> --
>> Sean Comerford, Software Engineer
>> ESPN.com Site Architecture Group
>> Office: 860.766.6454 Cell: 860.329.5842
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

-- 
Sean Comerford, Software Engineer
ESPN.com Site Architecture Group
Office: 860.766.6454    Cell: 860.329.5842