0
点赞
收藏
分享

微信扫一扫

No mapping found for HTTP request with URI


说明

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

No mapping found for HTTP request with URI_spring

临时建了一个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_java_02

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


举报

相关推荐

0 条评论