No mapping found for HTTP request with URI
  i1kyfCuzqmm7 2023年11月19日 22 0


说明

ssm老项目,接过来别人的项目

No mapping found for HTTP request with URI_java

临时建了一个Controller方便测试用的,结果访问掉不通,报: No mapping found for HTTP request with URIxxxx 这样的错误

解决办法

看了下web,xml配置

在 webmvc-config.xml 配置文件里面添加了几行配置

说明: com.iph.hiring.headcount.api.service.* 是我Controller所在的地址,
酷酷一顿乱粘, 重启项目,发现好使了.

<context:annotation-config/>
    <context:component-scan base-package="com.iph.hiring.headcount.api.service.*"
                            use-default-filters="false">
        <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
        <context:include-filter type="annotation" expression="org.springframework.context.annotation.Configuration"/>
        <context:include-filter type="annotation" expression="org.springframework.web.bind.annotation.RestController"/>
    </context:component-scan>
    <mvc:annotation-driven/>
    <mvc:default-servlet-handler/>
    <!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 -->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/pages/"/>
        <property name="suffix" value=".jsp"/>
    </bean>

启动项目观察控制台

发现有这个url地址了

No mapping found for HTTP request with URI_spring_02

然后用postman调用, 也能调用通过了.


【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月19日 0

暂无评论

推荐阅读
i1kyfCuzqmm7