本文介绍了如何使用CDI 1.0从扫描中排除类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在CDI 1.0中排除扫描类。我在WebLogic 12.1.12中使用了CDI的默认实现(Weld,CDI 1.0)。

I would like to exclude a class from scanning in CDI 1.0. I'm using the default implementation of CDI in WebLogic 12.1.12 (Weld, CDI 1.0).

我看到了几个带有CDI 1.1的网站和文档,但没有使用以前的版本。

I saw several web sites and docs with CDI 1.1 but not with the previous release .

推荐答案

使用Weld,您可以在 beans.xml中使用自定义XML命名空间从扫描中排除类:

With Weld, you can use a custom XML namespace in beans.xml to exclude classes from scanning:

 <beans xmlns="http://java.sun.com/xml/ns/javaee" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xmlns:weld="http://jboss.org/schema/weld/beans">
   <weld:scan>
     <weld:exclude name="com.acme.swing.**"/>
   </weld:scan>
 </beans>

参见了解详情。

这篇关于如何使用CDI 1.0从扫描中排除类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 20:28