web.xml配置如下: <!-- Spring Configuration -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:META-INF/beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>Jersey Spring Web Application</servlet-name>
<servlet-class>
com.sun.jersey.spi.spring.container.servlet.SpringServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet> <servlet-mapping>
<servlet-name>Jersey Spring Web Application</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
如下发布没有问题,当发布类实现某个接口就不行了,访问页面直接报404错误.@Component
@Path("/test")
public class Hello {
@Path("/getMsg")
@GET
@Produces("text/plain")
public String getClichedMessage() {
return "Hello World";
}
}
错误的代码:@Component
@Path("/test")
public class Hello implements IHello {...}
请问大家这是什么原因?
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:META-INF/beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>Jersey Spring Web Application</servlet-name>
<servlet-class>
com.sun.jersey.spi.spring.container.servlet.SpringServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet> <servlet-mapping>
<servlet-name>Jersey Spring Web Application</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
如下发布没有问题,当发布类实现某个接口就不行了,访问页面直接报404错误.@Component
@Path("/test")
public class Hello {
@Path("/getMsg")
@GET
@Produces("text/plain")
public String getClichedMessage() {
return "Hello World";
}
}
错误的代码:@Component
@Path("/test")
public class Hello implements IHello {...}
请问大家这是什么原因?
解决方案 »
- Spring如何配置,运行源代码?
- 基于struts+hibernate请教分页问题
- EJB3.0,jboss4.2.2,跨越多数据库时,出错,求解决方法!!!!
- Java程序传输值给C++程序
- 熟悉ssh2 的高手们请帮忙
- struts使用Validator验证框架问题
- 求助!java.net.ConnectException: Connection timed out: connect
- 请问 hibernate 如何根据某一列的统计结果排序
- 免费提供把EJb转换成适合Jboss和Weblogic的程序
- spring+Junit测试 Failed to load ApplicationContext
- spring动态载入
- 别人写好的框架中样式的修改问题
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;import org.springframework.stereotype.Component;@Component
@Path("/test")
public class HelloImpl implements Hello { @Path("/getMsg")
@GET
@Produces("text/plain")
public String getClichedMessage() {
return "Hello World";
}
}