情况一:
controller路径不对,springboot扫描controller默认扫启动类当前包及其子包
例如:application类在包com.demo下,controller在包com.user下,这样默认是不会扫描com.user下的controller的
方法一:
以启动类的包路径作为顶层包路径,列如启动类包为com.demo,那么Controller包路径就为com.demo.controller。
方法二:
在启动上方添加@ComponentScan注解,此注解为指定扫描路径,例如:@ComponentScan(basePackages = {"com.user.*"}) 多个不同的以逗号分割
情况二:
使用post请求,但是controller取参数没有使用@responsebody注解