Spring Boot: Cannot access REST Controller on localhost (404)

前端 未结 18 1537
天命终不由人
天命终不由人 2020-11-27 12:05

I am trying to adapt the REST Controller example on the Spring Boot website. Unfortunately I\'ve got the following error when I am trying to access the localhost:8080/

18条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 12:32

    I had this issue and what you need to do is fix your packages. If you downloaded this project from http://start.spring.io/ then you have your main class in some package. For example if the package for the main class is: "com.example" then and your controller must be in package: "com.example.controller". Hope this helps.

提交回复
热议问题