I have following in my Dockerfile for a simple spring boot rest service project:
FROM openjdk:8
EXPOSE 8080
ADD /target/spotdemo-0.0.1-SNAPSHOT.jar spotdemo.jar
ENTRYPOINT ["java", "-jar", "spotdemo.jar"]
Image is build successfully, and I can launch container for it too:
docker run -p 8080:8080 -t spotdemo-microservice
..........
Started SpotDemoApplication in 3.256 seconds (JVM running for 4.005)
But trying to access endpoint from postman throws error:
{
"timestamp": "2020-04-15T15:08:43.218+0000",
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/hello"
}
What else I am supposed to do here?
Edit:
Controller is as:
@RestController
public class TestController {
@GetMapping("/hello")
public String hello() {
return "Hello World";
}
}
Call is as: