今天做SpringBoot小例子,在请求controller层的时候出现如下问题。

 

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Dec 14 16:35:25 CST 2016
There was an unexpected error (type=Not Found, status=404).
No message available

 

问题很像是没有访问地址不对,第一感觉以为url写的不对。

其实不是,真正的原因是【Application启动类放的位置不对】要将Application放在最外层,也就是要包含所有子包。

比如你的groupId是com.google,子包就是所谓的com.google.xxx,所以要将Application类要放在com.google包下。

springboot会自动加载启动类所在包下及其子包下的所有组件.

相关文章:

  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2021-05-29
  • 2021-07-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-18
  • 2021-04-22
  • 2021-07-02
  • 2022-12-23
  • 2021-11-18
  • 2021-11-12
相关资源
相似解决方案