tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <>
Subject Re: Injection of objet created by interceptor (per request)
Date Fri, 11 May 2012 19:21:56 GMT
On May 9, 2012, at 3:52 AM, Eric Chatellier wrote:

> Hi,
> I'm currently using openejb 4.0 as embedded ejb container.
> I'm also trying to find a proper way to create object
> in interceptor and getting access to them in EJB.
> Is there any way to:
> - create an object (in this case a transaction to a custum persistence framefork)
> - put it somewhere
> - inject it on EJB using @Inject or @Resource
> Note: the created object must be unique per transaction, so can't be
> defined in container configuration.

Some usage of CDI @RequestScoped is probably what is in order here.

Depending on what the interceptor is doing, you might not even need it.  Everything in RequestScoped
is created automatically the first time it is used in the request, so if the interceptor is
just creating things in the request you probably won't even need it.


View raw message