加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

java – RequestMappingHandlerMapping.getHandlerInternal:2

发布时间:2020-12-15 01:31:38 所属栏目:大数据 来源:网络整理
导读:试图制作一些弹簧示例程序 不断得到错误 发生我的控制器无法处理/你好请求.这是来自log4j的调试信息. 13:50:58,502 {TRACE} DispatcherServlet.initContextHolders:1018 - Bound request context to thread: org.apache.catalina.connector.RequestFacade@63

试图制作一些弹簧示例程序 – 不断得到错误 – 发生我的控制器无法处理/你好请求.这是来自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配置文件中有一个错字指向包:

是:

修正了正确的拼写:

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读