简体   繁体   English

带有 JBOSS / Wildfly EJB 3 类的字节好友

[英]Byte Buddy with JBOSS / Wildfly EJB 3 classes

I'm try to intercept all method into a javaEE application running under widlfly/jboss (in specific case JBOSS EAP 7.3.x)我尝试将所有方法拦截到在 widlfly/jboss 下运行的 javaEE 应用程序中(在特定情况下为 JBOSS EAP 7.3.x)

But really it seems EJB 3.x methods are not intecepted但实际上似乎 EJB 3.x 方法没有被拦截

my code is我的代码是

      new AgentBuilder.Default()
      .type((ElementMatchers.any()))
      .transform((builder, typeDescription, classLoader, module) -> builder
            .method(ElementMatchers.any()).intercept(Advice.to(MyProfilerTimer.class)))
      .installOn(inst);

So, I enabled "any" as ElementMatcher but also in this case, EJB are not considered所以,我启用了“any”作为 ElementMatcher 但在这种情况下,EJB 不被考虑

EJBs are annotetad as Stateless (they are not remote ejb) EJB 被注解为无状态(它们不是远程 ejb)

@SuppressWarnings("all")
@Stateless(name = "MyEJBSession")
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class MyEJBSession 
{

I believe due the JBOSS logic to instantiate it via proxy or delegation etc我相信由于 JBOSS 逻辑通过代理或委托等方式实例化它

Do you have idea how can add my intercetor ?你知道如何添加我的拦截器吗? i'm using latest byte buddy version我正在使用最新的字节好友版本

thanks谢谢

Byte Buddy registers an implicit .ignore matcher that excludes synthetic types, the bootstrap class loader and Byte Buddy's own types. Byte Buddy 注册了一个隐式的.ignore匹配器,它排除了合成类型、引导类加载器和 Byte Buddy 自己的类型。 Mostly, this is what people want but if you use JBoss, it might generate classes that are marked as synthetic.大多数情况下,这是人们想要的,但如果您使用 JBoss,它可能会生成标记为合成的类。 Probably, you need to register a custom ignore matcher that does not exclude the classes.可能,您需要注册一个不排除类的自定义忽略匹配器。

You can also always register a listener to your agent builder to see if the class is discovered at all.您还可以随时向您的代理构建器注册一个侦听器,以查看是否发现了该类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM