出現(xiàn)這個(gè)錯(cuò)也可能會(huì)出現(xiàn)項(xiàng)目無(wú)法啟動(dòng)的錯(cuò)誤。完整錯(cuò)誤是
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'recureController' method
一、錯(cuò)誤出現(xiàn)原因:
? ? ? ? controller層出現(xiàn)了重復(fù)的方法映射
????????
????????可以看到圖片中兩個(gè)方法的映射是一樣的,這是問(wèn)題所在
解決方法也很簡(jiǎn)單,既然已經(jīng)知道了問(wèn)題所在那么解決起來(lái)也很簡(jiǎn)單,只需要將重復(fù)的方法映射修改即可
二、另外,項(xiàng)目無(wú)法啟動(dòng),一般存在配置錯(cuò)誤。像我們常用的xml,或者是控制層的錯(cuò)誤,在這里說(shuō)幾個(gè)常見(jiàn)的原因
1.? ? ? ? mapper.xml文件里出現(xiàn)了空的namespace路徑(無(wú)法連接dao層)
2.? ? ? ? mapper.xml文件里有重復(fù)的方法名
3.? ? ? ? 將resultMap和resultType寫(xiě)反(這里要明白兩者的區(qū)別)文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-689015.html
?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-689015.html
到了這里,關(guān)于解決Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘inteController‘的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!