java – RequestMappingHandlerMapping.getHandlerInternal:230 – 没有找到处理程序方法

试图制作一些弹簧示例程序 – 不断得到错误 – 发生我的控制器无法处理/你好请求.这是来自log4j的调试信息.

    13:50:58,502 {TRACE} DispatcherServlet.initContextHolders:1018 - Bound request context to thread: org.apache.catalina.connector.RequestFacade@636f2067
    13:50:58,503 {DEBUG} DispatcherServlet.doService:823 - DispatcherServlet with name 'springtest' processing GET request for [/springtest_2/hello]
    13:50:58,504 {TRACE} DispatcherServlet.getHandler:1088 - Testing handler map         
[org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping@7bab2c3] in DispatcherServlet with name 'springtest'
    13:50:58,504 {DEBUG} RequestMappingHandlerMapping.getHandlerInternal:220 - Looking          
    up handler method for path /hello
    13:50:58,504 {DEBUG} RequestMappingHandlerMapping.getHandlerInternal:230 - Did not find handler method for [/hello]
    13:50:58,504 {TRACE} DispatcherServlet.getHandler:1088 - Testing handler map [org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping@722e242b] in         DispatcherServlet with name 'springtest'
    13:50:58,505 {TRACE} BeanNameUrlHandlerMapping.getHandlerInternal:127 - No handler mapping found for [/hello]
    13:50:58,505 {WARN} PageNotFound.noHandlerFound:1108 - No mapping found for HTTP request with URI [/springtest_2/hello] in DispatcherServlet with name 'springtest'  
    13:50:58,505 {TRACE} DispatcherServlet.resetContextHolders:1028 - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@636f2067
    13:50:58,505 {DEBUG} DispatcherServlet.processRequest:966 - Successfully completed request
    13:50:58,506 {TRACE} XmlWebApplicationContext.publishEvent:332 - Publishing event in WebApplicationContext for namespace 'springtest-servlet': ServletRequestHandledEvent: url=[/springtest_2/hello]; client=[0:0:0:0:0:0:0:1]; method=[GET]; servlet=[springtest]; session=[null]; user=[null]; time=[9ms]; status=[OK]

我项目中的web.xml.

    

spring-test-servlet.xml – 我项目中的调度程序文件

ControllerMain.java – 来自我的项目

package com.denmroot.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class ControllerMain {

@RequestMapping(value = "/hello",method = RequestMethod.GET)
    public String helloworld (ModelMap model) {
    model.addAttribute("message","Hello World !!! Spring Output");
    return "hello";     
}

}
最佳答案
对我来说,我在Spring配置文件中有一个错字指向包:

是:

修正了正确的拼写:

相关文章

这篇文章主要介绍了spring的事务传播属性REQUIRED_NESTED的原...
今天小编给大家分享的是一文解析spring中事务的传播机制,相...
这篇文章主要介绍了SpringCloudAlibaba和SpringCloud有什么区...
本篇文章和大家了解一下SpringCloud整合XXL-Job的几个步骤。...
本篇文章和大家了解一下Spring延迟初始化会遇到什么问题。有...
这篇文章主要介绍了怎么使用Spring提供的不同缓存注解实现缓...