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

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

    Same 404 response I got after service executed with the below code

    @Controller
    @RequestMapping("/duecreate/v1.0")
    public class DueCreateController {
    
    }
    

    Response:

    {
    "timestamp": 1529692263422,
    "status": 404,
    "error": "Not Found",
    "message": "No message available",
    "path": "/duecreate/v1.0/status"
    }
    

    after changing it to below code I received proper response

    @RestController
    @RequestMapping("/duecreate/v1.0")
    public class DueCreateController {
    
    }
    

    Response:

    {
    "batchId": "DUE1529673844630",
    "batchType": null,
    "executionDate": null,
    "status": "OPEN"
    }
    

提交回复
热议问题