zoukankan      html  css  js  c++  java
  • org.springframework.web.servlet.DispatcherServlet noHandlerFound

    错误提示:

    org.springframework.web.servlet.DispatcherServlet noHandlerFound
    警告: No mapping found for HTTP request with URI [/spring/test] in DispatcherServlet with name 'spring'

    错误代码:@RequestMapping(name="/test")

    正确代码:@RequestMapping(value="/test")

    源码的注释:

    /**
         * Assign a name to this mapping.
         * <p><b>Supported at the type level as well as at the method level!</b>
         * When used on both levels, a combined name is derived by concatenation
         * with "#" as separator.
         * @see org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder
         * @see org.springframework.web.servlet.handler.HandlerMethodMappingNamingStrategy
         */
        String name() default "";

    /**
         * The primary mapping expressed by this annotation.
         * <p>In a Servlet environment this is an alias for {@link #path}.
         * For example {@code @RequestMapping("/foo")} is equivalent to
         * {@code @RequestMapping(path="/foo")}.
         * <p>In a Portlet environment this is the mapped portlet modes
         * (i.e. "EDIT", "VIEW", "HELP" or any custom modes).
         * <p><b>Supported at the type level as well as at the method level!</b>
         * When used at the type level, all method-level mappings inherit
         * this primary mapping, narrowing it for a specific handler method.
         */
        @AliasFor("path")
        String[] value() default {};

      这个错误搞了好久,因为凭着记忆写的,却偏偏将value误写成name,后台没有明显的提示错误信息,只是警告,所以就一直以为是配置信息有问题,一遍一遍的检测配置信息,一遍一遍的创建新的项目,一遍一遍的启动项目,真的是一手失成千古恨。

  • 相关阅读:
    Less35、Less36【无闭合注入,mysql_real_escape_string()】
    Less34【POST方式宽字符注入】
    Less29,30,31【jsp环境搭建、WAF】
    Less28、28a【select、union、空格过滤】
    Less27、27a【select、union、空格过滤】
    Less26,26a【空格符号过滤】
    Less25,25a【and/or过滤】
    Less24【二次注入】
    Less23【报错注入】
    NFC
  • 原文地址:https://www.cnblogs.com/July74/p/5216021.html
Copyright © 2011-2022 走看看