首先需要检查:
启动类是否放在所有包的父目录;
或者启动类增加注解@ComponentScan(basePackages={"com.demo.test.*"})
其次:
在Controller中,使用@RestController注解;
或者使用@Controller注解类,并且使用@ResponseBody注解方法
最后:
检查配置文件是否有server.context-path=/hello 配置,如果有则访问地址需要ip:port/hello的方式访问。

相关文章:

  • 2021-12-29
  • 2021-10-08
  • 2021-07-25
  • 2021-09-21
  • 2021-08-26
  • 2021-06-20
  • 2021-08-18
猜你喜欢
  • 2022-12-23
  • 2021-05-16
  • 2022-02-21
  • 2021-06-05
  • 2021-05-02
  • 2022-01-07
  • 2021-12-29
相关资源
相似解决方案