- SpringBoot:竟然has no explicit map
- springboot 踩坑 This application h
- This application has no explicit
- 开启Swagger:This application has n
- Springboot 2.2.X Spring Cloud报错之This application
- springboot项目的主Application类,一定要放在
- How to create a map legned in GM
- Alice’s Adventures in China No.2
- OpenLayers - Accessible Map(1) -
由于领导认为我很快要离职了,所以这个sprint没给我派任务,然后这两天太清闲,今天也是无聊,最近开始用springboot的项目,折腾到现在还有点晕,那我既然闲就自己弄个springBoot小项目写点无聊的东西练练手吧。
结果一上来就has no explicit mapping for /error……也是惆怅……折腾了半天才明白问题所在:启动类放的位置不对,启动类所在的package必须要包含Controller所在的package,当然直接把启动类放在项目最外层package中就最稳妥不过了。然后我们从头开始,重现问题及解决办法:
都说SpringBoot简单,果然简单,这样就能启动了:

添加必要的依赖,连application.properties都不需要就可以启动了:

然而在访问简单的controller接口的时候却出了错This application has no explicit mapping for /error, so you are seeing this as a fallback.:

大部分人都说这种情况通常是由于没有这个mapping对应的接口,然而我分明就是有,而且肯定不可能写错路径:

后来终于有一个人猜对了原因:启动类放的位置不对,启动类所在的package必须要包含Controller所在的package。
然后我改了下启动类StartWeeds.java的位置,果然正常了:

重新启动并访问接口:

That's All!Thank you !
网友评论