I'm trying to implement a Springboot REST api. and the class where I have defined the @RestController doesn't seem to be working. I have a class called MyService where it implements all the abstract methods. I have added the @RestController annotation on top of the class declaration and added the @RequestMapping annotation for the method that I need to call from the rest call. But this doesn't work. I tried this with a class which does not implement any interface and that works fine.
Here is the code
package com.my.service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class MyService implements MyServiceInterface{
@Override
@RequestMapping("/age")
public String Age() {
return "24";
}
}
the code of MyServiceInterface
public interface MyServiceInterface {
public String Age();
}
And the error I'm getting from postman is
{"timestamp":1489688505136,"status":404,"error":"Not Found","message":"No message available","path":"/age"}