Reputation: 3254
I have the following:
@RepositoryRestController
public class DataSetController {
@RequestMapping(value = "/cars/test", method = RequestMethod.GET)
public String testFetch() {
return "HELLO";
}
}
@RepositoryRestResource
public interface DataSetRepository extends PagingAndSortingRepository<DataSet, Integer>, QueryDslPredicateExecutor<DataSet> {}
The logs at startup indicate the following:
2015-08-21 18:49:46.050 INFO 52448 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/cars/test],methods=[GET]}" onto public java.lang.String com.example.hello.dataset.DataSetController.testFetch()
My base uri in my config is:
base-uri: /api
So I should be able to get localhost:8080/api/cars/test
But here is what I get in the logs:
2015-08-21 18:58:10.847 WARN 52476 --- [nio-8080-exec-1] o.s.web.servlet.PageNotFound : No mapping found for HTTP request with URI [/api/cars/test] in DispatcherServlet with name 'dispatcherServlet'
Why?
Upvotes: 1
Views: 12538
Reputation: 116041
You've said that you've used base-uri
in your config, but it should be spring.data.rest.base-uri
.
Upvotes: 0
Reputation: 3542
It seems that your base URI /api
is not set properly in your configuration, that's why the dispatcher can't find a proper mapping.
Since all your requests will have the /api
base I suggest you add a @RequestMapping annotation to your Controller :
@RepositoryRestController
@RequestMapping("/api")
public class DataSetController {
}
Upvotes: 5