You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by hwaastad <he...@waastad.org> on 2014/12/18 11:25:46 UTC
ExceptionMapper and @inject
Hi,
I'v noticed that I can inject into a @provider in 2.0.0-SNAPSHOT, ex a
exceptionmapper:
@Inject
private Event<ExceptionToCatchEvent> catchEvent;
but not in 1.7.1.
would that be possible or is this EE7 functionality?
br hw
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/ExceptionMapper-and-inject-tp4673237.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: ExceptionMapper and @inject
Posted by hwaastad <he...@waastad.org>.
Yes,
and you are right, it's working.
Something fishy with my maven cache.
br hw
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/ExceptionMapper-and-inject-tp4673237p4673246.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: ExceptionMapper and @inject
Posted by Romain Manni-Bucau <rm...@gmail.com>.
You mean you do:
@RequestScoped
public class Foo {
private Response resp; // + setter
@Produces
public Response rep() { return resp; }
}
@Path("...")
public class MyRep {
@Inject Foo foo;
@GET
public Response someEndpoint() { Response resp = ...,
foo.setResp(resp); return resp; }
}
@Prodiver
public class Mapper implements ExceptionMapper<...> {
@Inject Instance<Response> reps;
...
}
?
It should work yes. Ensure setResp is called early enough and that the
producer is well scanned
Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau
2014-12-18 12:23 GMT+01:00 hwaastad <he...@waastad.org>:
> Yeah,
> I see that it's OK in 1.7.2-snapshot.
>
> looking forward to 1.7.2 :-)
>
> another question:
> I've seen a couple og wildfly examples injecting an instance<Response> into
> a provider. (also having a producer somewhere).
>
> I have'nt really dug into it (will do) but I get a
> UnsatisfiedResolutionException. Any suggestions?
>
> br hw
>
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/ExceptionMapper-and-inject-tp4673237p4673239.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
Re: ExceptionMapper and @inject
Posted by hwaastad <he...@waastad.org>.
Yeah,
I see that it's OK in 1.7.2-snapshot.
looking forward to 1.7.2 :-)
another question:
I've seen a couple og wildfly examples injecting an instance<Response> into
a provider. (also having a producer somewhere).
I have'nt really dug into it (will do) but I get a
UnsatisfiedResolutionException. Any suggestions?
br hw
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/ExceptionMapper-and-inject-tp4673237p4673239.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: ExceptionMapper and @inject
Posted by Romain Manni-Bucau <rm...@gmail.com>.
No more sure but I think it was backported to 1.7.2-SNAPSHOT..but not
sure it is a EE feature.
Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau
2014-12-18 11:25 GMT+01:00 hwaastad <he...@waastad.org>:
> Hi,
> I'v noticed that I can inject into a @provider in 2.0.0-SNAPSHOT, ex a
> exceptionmapper:
>
> @Inject
> private Event<ExceptionToCatchEvent> catchEvent;
>
> but not in 1.7.1.
>
> would that be possible or is this EE7 functionality?
>
> br hw
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/ExceptionMapper-and-inject-tp4673237.html
> Sent from the TomEE Users mailing list archive at Nabble.com.