Fórum Spring No mapping found for HTTP request with URI #509744
06/02/2015
0
Pessoal, estou tentando criar um controller, porem esta dando o erro abaixo :
http://localhost:8080/SpringMVCAngularJS/service/greeting
ev 06, 2015 10:35:02 AM org.springframework.web.servlet.PageNotFound noHandlerFound
ADVERTÊNCIA: No mapping found for HTTP request with URI [/SpringMVCAngularJS/service/greeting] in DispatcherServlet with name 'appServlet'
http://localhost:8080/SpringMVCAngularJS/service/greeting
ev 06, 2015 10:35:02 AM org.springframework.web.servlet.PageNotFound noHandlerFound
ADVERTÊNCIA: No mapping found for HTTP request with URI [/SpringMVCAngularJS/service/greeting] in DispatcherServlet with name 'appServlet'
package springapp.web;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/service/greeting")
public class SpringServiceController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String getGreeting(@PathVariable String name) {
String result="Hello "+name;
return result;
}
}
dispatcher-servlet.xml
view plaincopy to clipboardprint?
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<context:component-scan base-package="springapp.web" />
<mvc:annotation-driven />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>
Evandro Abreu
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)