[weld-dev] Creating default interceptor for EJBs

Rebecca Searls rsearls at redhat.com
Tue Jul 23 08:13:04 EDT 2019


It is true the customer code has no interceptor binging.  We have no
control over the EJB
definition the user provides.  We do know that any interceptor class the
customer provides
in the @Interceptors annontation will have a @PostConstruct annotation.  Is
it possible to
programmatically associate an interceptor with that?

On Tue, Jul 23, 2019 at 4:06 AM Matej Novotny <manovotn at redhat.com> wrote:

> Hello,
>
> I am not quite sure I follow what are you trying to achieve here.
>
> I can see you are trying to register a synthetic interceptor via
> WeldAfterBeanDiscovery.addInterceptor().
> What I am missing is how do you bind this interceptor to your
> PostConstructInjectionEJBResource?
> Because interceptors registered via WeldAfterBeanDiscovery are those that
> work on based on interceptor bindings and there is no binding on your
> Resource class.
>
> Could you elaborate a little please?
> Matej
>
> ----- Original Message -----
> > From: "Rebecca Searls" <rsearls at redhat.com>
> > To: weld-dev at lists.jboss.org
> > Sent: Monday, July 22, 2019 8:37:16 PM
> > Subject: [weld-dev] Creating default interceptor for EJBs
> >
> >
> > Resteasy would like to address the following scenario with a default
> > interceptor
> > that is executed after classes defined in an @Interceptors stmt are
> executed.
> >
> > For example a customer provides an EJB with a defined @Interceptors stmt.
> >
> > @Path("/ejb")
> > @Stateless
> > @Interceptors ({PostConstructInjectionEJBInterceptor.class})
> > public class PostConstructInjectionEJBResource {
> > @Size(max=3)
> > private String t = "yz";
> >
> > @Path("get")
> > @GET
> > public String get() {
> > return t;
> > }
> >
> > public void setT(String t) {
> > this.t = t;
> > }
> > }
> >
> > Resteasy provides a CDI extension class, ResteasyCdiExtension. This is
> where
> > I am trying to made the addition. I've reviewed the Weld docs and tried
> > wrapping the class with an @Interceptor both with and without @Priority;
> > using WeldAfterBeanDiscovery's addInterceptor method all without success.
> >
> > Would you provide advise as to how best to address this?
> >
> > _______________________________________________
> > weld-dev mailing list
> > weld-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/weld-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20190723/f4b76fcc/attachment-0001.html 


More information about the weld-dev mailing list