在WAR中禁用对CDI bean的扫描 [英] Disable scanning of CDI beans in WAR

查看:106
本文介绍了在WAR中禁用对CDI bean的扫描的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有带有CDI bean的WAR软件包.软件包的部署非常缓慢,因为在部署过程中每次都在软件包中扫描CDI bean.是否有任何选项可以禁用此过程?

I have WAR package with CDI beans. Deployment of the package is very slow because every time during deployment the package is scanned for CDI beans. Is there any option to disable this process?

推荐答案

正确的方法是禁用相关归档文件的bean.xml中的发现:

The correct way is to disable discovery in the beans.xml of the relevant archive:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
                        http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
    version="1.1" bean-discovery-mode="none">
</beans>

根据 CDI规范,该删除了从bean存档列表中存档.

According to the CDI specification this removes the archive from the list of bean-archives.

这篇关于在WAR中禁用对CDI bean的扫描的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆