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,后台没有明显的提示错误信息,只是警告,所以就一直以为是配置信息有问题,一遍一遍的检测配置信息,一遍一遍的创建新的项目,一遍一遍的启动项目,真的是一手失成千古恨。

  • 相关阅读:
    BZOJ 2306 幸福路径(DP)
    BZOJ 2303 方格染色(带权并查集)
    2011 Multi-University Training Contest 8
    POJ 1379 Run Away(模拟退火)
    BZOJ 3680 吊打XXX(模拟退火)
    POJ 3074 Sudoku(Dancing Links)
    java 基础语法 1
    java 配置环境变量
    windows 结束进程的详细过程
    在同一台服务器上配置多个Tomcat
  • 原文地址:https://www.cnblogs.com/July74/p/5216021.html
Copyright © 2011-2022 走看看