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

前端 未结 18 1491
天命终不由人
天命终不由人 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:31

    SpringBoot developers recommend to locate your main application class in a root package above other classes. Using a root package also allows the @ComponentScan annotation to be used without needing to specify a basePackage attribute. Detailed info But be sure that the custom root package exists.

提交回复
热议问题