波神

导航

springboot启动正常,访问restController报404

原因:spring boot只会扫描启动类当前包和以下的包 

比如以下:

主类:Application放在包com.springboot.main

controller类放在包com.springboot.controller

上面这处情况是找不到controller的

 

正确的做法是:

Application放在包com.springboot

controller类放在com.springboot.controller,这样相当于controller的在的包属于com.springboot底下。

posted on 2017-05-19 13:55  波神  阅读(3111)  评论(0)    收藏  举报