为什么 InvocationInterceptor 在开发模式下处于活动状态?

Why is InvocationInterceptor active in dev-mode?

今天,在分析 Quarkus 应用程序时,我发现当 Quarkus 运行 处于开发模式时,io.quarkus.arc.runtime.devconsole.InvocationInterceptor 似乎拦截(几乎?)所有 bean 类,即使Interceptor 有一个 InterceptorBinding,它没有在应用程序代码中的任何地方使用。

@Inherited
@InterceptorBinding
@Target({ TYPE, METHOD })
@Retention(RUNTIME)
public @interface Monitored {
}


@Priority(Interceptor.Priority.LIBRARY_BEFORE)
@Monitored
@Interceptor
public class InvocationInterceptor {
//...
}

有人可以向我解释为什么会这样吗?我真的无法判断这是预期行为还是错误。 InterceptorBinding 是否在构建期间自动散布在我的应用程序周围?我查看了代码,但找不到发生这种情况的地方。

为什么我对此感兴趣?这个拦截器确实使用 CopyOnWriteArrayList(在 Invocation.Builder 内)进行簿记,在热循环中,它会快速生成该列表的数万个副本。今天,当我分析应用程序时,这让我很困惑,因为生产模式和开发模式之间的内存需求截然不同。

(如果相关:所有这些都发生在 Quarkus 2.7 中。3.Final)

这基本上是@Ladicek 的评论:

[The behaviour] is intentional, but there are discussions it should be off by default. In any case, there's a configuration property to switch it off.

我还找到了神奇的 BuildExtension:它位于 io.quarkus.arc.deployment.devconsole.ArcDevConsoleProcessor.