Reputation: 2705
I created a @RestController
for all @Entity
objects the REST URL is being set correctly using spring.data.rest.base-path
variable set in application.peroperties
as /api
but for a @RequestMapping("someEndpoint")
it is not using the variable.
Example
For @Entity
class User the REST endpoint is located at:
`http://localhost:8081/api/users'
But when I try to access someEndpoint
:
'http://localhost:8081/api/someEndpoint'
I get a response of:
Response Status
HTTP/1.1 404 Not Found
Body
"timestamp":1461267817272,"status":404,"error":"Not Found","message":"No message available","path":"/api/someEndpoint"}
Instead the endpoint of the REST service is located at
'http://localhost:8081/someEndpoint'
Response:
HTTP/1.1 200 OK
Controller class
@RestController
public class HomeController {
@RequestMapping(value = "/")
public String index() {
return "index";
}
@RequestMapping("someEndpoint")
public Stuff runSomething(
@RequestParam(value = "id", required = true) String id)
What am I missing in my configuration?
Thank you
Upvotes: 1
Views: 2789