in28minutes / spring-boot-examples

Code Examples for everything thats written on www.springboottutorial.com
https://www.springboottutorial.com
1.24k stars 3.36k forks source link

Not able to test http://localhost:8000/currency-exchange/from/EUR/to/INR #4

Open ashokvn opened 5 years ago

ashokvn commented 5 years ago

I created the forex microservice exactly as given in http://www.springboottutorial.com/creating-microservices-with-spring-boot-part-2-forex-microservice. I ran the appplication and tried to test the url http://localhost:8000/currency-exchange/from/EUR/to/INR, but getting the whilte lable error page. From postman I got the below response { "timestamp": "2018-10-21T16:08:58.060+0000", "status": 404, "error": "Not Found", "message": "No message available", "path": "/currency-exchange/from/EUR/to/INR" } What could be the issue?

crassy commented 2 years ago

Since, this problem didn't answer, I am providing the solution now.

If the "@SpringBootApplication" class contains in com.xyz.bootapplication package, then the controller should be located at com.xyz.bootapplication.controller package.

If the controller which is having "@RestController" annotation is located at any other location ex: com.xyz.controller then the problem will be happen.

So please place the "@SpringBootApplication" class at the top of the class hierarchy.