Java 在Eclipse中运行非常简单的Weld SE项目
我一直在我的web应用程序中使用Seam 2(也开始研究Java EE 6),几天前我发现Seam的CDI可以在带有Weld的SE应用程序中使用。根据Weld的文档页面,设置非常简单。所以我尝试用一个类HelloWeld、weld-se.jar和log4j jars来设置一个Eclipse项目Java 在Eclipse中运行非常简单的Weld SE项目,java,eclipse,jboss-weld,Java,Eclipse,Jboss Weld,我一直在我的web应用程序中使用Seam 2(也开始研究Java EE 6),几天前我发现Seam的CDI可以在带有Weld的SE应用程序中使用。根据Weld的文档页面,设置非常简单。所以我尝试用一个类HelloWeld、weld-se.jar和log4j jars来设置一个Eclipse项目 @Singleton public class HelloWeld { public void printHello(@Observes ContainerInitialized event, @
@Singleton
public class HelloWeld
{
public void printHello(@Observes ContainerInitialized event, @Parameters List<String> parameters)
{
System.out.println("Hello Weld!");
}
}
那么我遗漏了什么呢?你需要把它变成一个bean存档。将空的META-INF/beans.xml添加到类路径
11:54:39,397 INFO [weld.Version] WELD-000900 1.0.1 (Final)
11:54:39,428 INFO [weld.Bootstrap] WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
11:54:39,944 WARN [model.InterceptionTypeRegistry] Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled
11:54:39,944 WARN [model.InterceptionTypeRegistry] Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled