Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can the classpath scanning be controlled in Weld?

I was playing with Weld-SE (Java SE) and noticed that if there are a lot of JARs in the classpath, the JVM startup time runs into several seconds.

Isn't there a way to specify/restrict the scan path as a package pattern or path pattern like in Apache Ant or AspectJ?

PS: Registration on Weld forum just does not work - it keeps saying "your password is trivial"

like image 626
Ashwin Jayaprakash Avatar asked Aug 18 '11 22:08

Ashwin Jayaprakash


People also ask

What is Weld CDI?

Weld is the reference implementation of CDI: Contexts and Dependency Injection for the Java EE Platform - a JCP standard for dependency injection and contextual lifecycle management and one of the most important and popular parts of the Java EE.

What is Weld servlet shaded?

weld-servlet-shaded. jar is an "uber-jar", meaning it bundles all the bits of Weld and CDI required for running in a Servlet container, for your convenience. Alternatively, you can use its component jars. A list of transitive dependencies can be found in the META-INF/DEPENDENCIES.

What is Weld servlet?

Weld is the reference implementation of CDI for the Java EE Platform. Weld is integrated into many Java EE application servers such as WildFly, JBoss, GlassFish, and others. Weld can also be used in plain servlet containers (Tomcat, Jetty) or Java SE.


1 Answers

Starting with weld 1.1.0, it is possible according to Weld reference documentation :

<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" 
       xsi:schemaLocation="
          http://java.sun.com/xml/ns/javaee http://docs.jboss.org/cdi/beans_1_0.xsd
          http://jboss.org/schema/weld/beans http://jboss.org/schema/weld/beans_1_1.xsd">
    <weld:scan>
        <weld:exclude name="mypackage.MyClass"/>
    </weld:scan>
</beans>
like image 172
Dar Whi Avatar answered Oct 05 '22 08:10

Dar Whi