How to fully disable WELD on WildFly. I don\'t need it, because I use another DI framework.
Exception 0 : javax.enterprise.inject.UnsatisfiedResolut
Try deleting or commenting out the org.jboss.as.weld
extension in the extensions list on the beginning of $JBOSS_HOME/standalone/configuration/standalone.xml
. You may also want to delete <subsystem xmlns="urn:jboss:domain:weld:1.0"/>
from <profile>
. This should cause disabling Weld for all applications deployed on the server.
There's the standard way:
<?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>
This is Weld-specific, but it disables Weld's automatic bean scanning for an entire deployment (eg a war file and all the jars inside it). This is handy when you can't easily add beans.xml
to a third-party jar, such as jboss-seam-resteasy.jar.
Save as WEB-INF/jboss-all.xml
for wars, META-INF/jboss-all.xml
otherwise:
<jboss xmlns="urn:jboss:1.0">
<weld xmlns="urn:jboss:weld:1.0" require-bean-descriptor="true"/>
</jboss>
See Per-deployment configuration.
Another option, which doesn't require changing the application itself, is to configure the weld subsystem not to treat random jars as CDI libraries. Just edit the configuration for weld in WildFly's standalone.xml
to look like this:
<subsystem xmlns="urn:jboss:domain:weld:2.0" require-bean-descriptor="true"/>