參考: 參考地址
說明
ssm老項目,接過來別人的項目
臨時建了一個Controller方便測試用的,結果訪問掉不通,報: No mapping found for HTTP request with URIxxxx 這樣的錯誤
解決辦法
看了下web,xml配置
在 webmvc-config.xml 配置文件里面添加了幾行配置
說明: com.iph.hiring.headcount.api.service.* 是我Controller所在的地址,
酷酷一頓亂粘, 重啟項目,發(fā)現(xiàn)好使了.
<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>
啟動項目觀察控制臺
發(fā)現(xiàn)有這個url地址了
文章來源:http://www.zghlxwxcb.cn/news/detail-666057.html
然后用postman調用, 也能調用通過了.文章來源地址http://www.zghlxwxcb.cn/news/detail-666057.html
到了這里,關于No mapping found for HTTP request with URI的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!