<dependency> <groupId>org.jboss.weld.se</groupId> <artifactId>weld-se</artifactId> <version>3.1.3.Final</version> </dependency> import org.jboss.weld.environment.se.Weld; import org.jboss.weld.environment.se.WeldContainer; public class MyApp { public static void main(String[] args) { Weld weld = new Weld(); WeldContainer container = weld.initialize(); // Your application logic goes here weld.shutdown(); } } import javax.inject.Inject; public class MyService { private MyRepository repository; @Inject public MyService(MyRepository repository) { this.repository = repository; } // Your service methods go here } public class MyRepository { // Your repository methods go here } <?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_2_0.xsd" bean-discovery-mode="all"> </beans>


上一篇:
下一篇:
切换中文