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 {...}
请问大家这是什么原因?
解决方案 »
- Struts1的formBean为何取不到页面的数据?
- hibernate的session是线程安全的吗
- servlet下载的文件名不符
- Tomcat下 URL 如果带有汉字,如:http://localhost:8080/app/temp/upload/非技术.jpg 就显示不出来,大虾帮帮忙
- 请教:sqlserver的jdbc驱动中有没有rowset的实现
- struts中ACTIONFORM的处理问题
- 一个发送字符的问题
- 关于struts 中form表单中的name属性的问题,十万火急啊!!!!
- j2ee j2me 哪个有钱图,学EJB要学JAVABEAN么
- 求大神看看我这个怎么了啊,啥错误下面是日志
- 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";
}
}