springboot启动正常,访问restController报404

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

比如以下:

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

controller类放在包com.springboot.controller

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

正确的做法是:

Application放在包com.springboot

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

原文地址:https://www.cnblogs.com/boshen-hzb/p/6878002.html