gpt4 book ai didi

How can I exclude/remove a CDI extension that is added through a 3rd party jar?(如何排除/删除通过第三方JAR添加的CDI扩展?)

转载 作者:bug小助手 更新时间:2023-10-25 20:35:11 31 4
gpt4 key购买 nike



As the title says, I want to exclude/remove a CDI extension at runtime that is added through a 3rd party jar? I tried several like ( but with no success) :

正如标题所说,我想在运行时排除/删除通过第三方JAR添加的CDI扩展?我尝试了几种(但都没有成功):



  • AlterableContext destroy

  • veto-ing


更多回答
优秀答案推荐

You cannot. You can remove it from the classpath, but if it is bundled with a jar that contains other stuff you need, this may not be an option. You can veto certain things it does. If that is not working, then either the extension does not properly respect vetoes, or it is adding (definitionally non-vetoable) synthetic beans (or the like).

你不能这么做。您可以将其从类路径中删除,但如果将其与包含您需要的其他内容的JAR捆绑在一起,则可能不会这样做。你可以否决它所做的某些事情。如果这不起作用,那么要么是扩展没有正确地尊重否决权,要么是添加了(明确地说是不可否决的)合成豆(等等)。


(For completeness, an AlterableContext has nothing to do with portable extensions.)

(为了完整性,AlterableContext与可移植扩展无关。)


更多回答

I thought that by using AlterableContext, I might succeed in removing some "ExtensionBean" types from the ApplicationContext, but I guess the context is immutable in this regard. At a deeper level I guess I had a similar interaction with you on a similar topic on the helidon slack channel, regarding deactivating messaging channels by modifying the Helidon-messaging cdi extension to use specific properties. Similar to what smallrye is providing smallrye.io/smallrye-reactive-messaging/3.22.1/concepts/….

我以为通过使用AlterableContext,我可以成功地从ApplicationContext中移除一些“ExtensionBean”类型,但我想在这方面上下文是不变的。在更深的层面上,我想我在Helidon Slak通道上与您进行了类似的交互,关于通过修改Helidon消息传递CDI扩展以使用特定属性来停用消息传递通道的问题。与Smallrye提供的smallrye.io/smallrye-reactive-messaging/3.22.1/concepts/…类似。

It sounds then like you have a more specific question in mind?

那么听起来你心里有一个更具体的问题吗?

Well, yea at the base level, the concern was to disable messaging channel registration and connection which happens inside the MessagingCDIExtension inside helidon messaging, but since these things are 3rd party, I tried to look outward to find a way if possible to disable the extension entirely. I guess the end result that I wanted to achieve is to either have a property at the "mp.messaging" level or at the channel config level to disable, similar to "tracing.enable" property.

嗯,是的,在基本级别上,问题是禁用消息传递通道注册和连接,这发生在Helidon消息传递内部的MessagingCDIExtension中,但由于这些事情是第三方的,我试图向外寻找一种方法,如果可能的话,完全禁用该扩展。我想我想要实现的最终结果是在“mp.Messaging”级别或在通道配置级别禁用一个属性,类似于“tracing.Enable”属性。

Have you considered filing an enhancement on the Helidon Github project?

你有没有考虑过为Helidon Github项目提交增强版?

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com