"status": 404, "error": "not found", "message": "no message available", "path": "/api/employee"

 


first, make sure the YourController.java file that has the @Controller and the YourSpringBootFile.java file that has the @SpringBootApplication are in the same package.

If you want your controller to be in a different package outside of YourSpringBootFile.java's package, then follow these instructions = Spring: Run multiple "SpringApplication.Run()" in application main method

There are 2 methods to overcome this

  1. Place the bootup application at the start of the package structure and rest all controllers inside it.

    Example :

    package com.spring.boot.app; - You bootup application(i.e. Main Method -SpringApplication.run(App.class, args);)

    You Rest Controller in with the same package structure Example: package com.spring.boot.app.rest;

  2. Explicitly define the Controller in the Bootup package.

Method 1 is more cleaner.





referred to: https://stackoverflow.com/questions/31318107/spring-boot-cannot-access-rest-controller-on-localhost-404


https://stackoverflow.com/questions/34135205/getting-no-message-available-error-with-spring-boot-rest-application

Comments

Popular posts from this blog

There was an unexpected error (type=Not Found, status=404). No message available in Springboot