Why is the interceptor not called in the same service class?

后端 未结 1 2011
-上瘾入骨i
-上瘾入骨i 2020-12-20 17:47

I want to use interceptors in a Java-SE application and I am using weld as CDI implementation and i\'m testing this here:

The Main-Class:

         


        
相关标签:
1条回答
  • 2020-12-20 18:24

    The interceptor is not called because you are calling it on the same instance of the object. If you're familiar with EJBs it's the same as calling a method on the same object instead of through the EJB context.

    If you debug through it you'll notic that the method call on the injected objects goes through a proxy. The method call from methodOne to methodTwo isn't proxied.

    0 讨论(0)
提交回复
热议问题