Java h@ApplicationPath下的apache.cxf CDI不工作
我正在尝试使用apache.cxf运行tomcat应用程序,但我得到: 找不到的请求http://localhost:8080/myApp/rest/test/hello/message/世界观察者 这是我的密码: MyApp类:Java h@ApplicationPath下的apache.cxf CDI不工作,java,rest,tomcat,jax-rs,cxf,Java,Rest,Tomcat,Jax Rs,Cxf,我正在尝试使用apache.cxf运行tomcat应用程序,但我得到: 找不到的请求http://localhost:8080/myApp/rest/test/hello/message/世界观察者 这是我的密码: MyApp类: @ApplicationPath("/test") public class MyApp extends Application { } 同学们好: @Path("/hello") public class Hello {
@ApplicationPath("/test")
public class MyApp extends Application { }
同学们好:
@Path("/hello")
public class Hello {
@GET
@Path("/message/")
@Produces(MediaType.APPLICATION_JSON)
public Response test() {
System.out.println("hello there ...");
return Response.ok().entity("hello there ... ").build();
}
}
我的maven依赖项:
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.cxf/cxf-bundle -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-integration-cdi</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet</artifactId>
<version>1.1.10.Final</version>
</dependency>
</dependencies>
org.apache.cxf
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<display-name>CXF Servlet</display-name>
<servlet-class>org.apache.cxf.cdi.CXFCdiServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<resource-env-ref>
<resource-env-ref-name>BeanManager</resource-env-ref-name>
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager
</resource-env-ref-type>
</resource-env-ref>
</web-app>