Reputation: 1146
I have the following controller:
@RepositoryRestController
public class TestController {
@RequestMapping(value = "/testables", method = RequestMethod.GET)
public String get(){
return "testin it";
}
}
And it is not picked up by Spring. I get 404 when I hit /apiroot/testables
address. If I change it to be @RestController and add the api root to request mapping value, then it works. Also, if I change the mapping to point to "/orders/testables"
, it works as @RepositoryRestController
. I also have the following controller in the same package which works fine:
@RepositoryRestController
public class SendEmailController {
@Autowired
private MessageSource messageSource;
@Autowired
private JavaMailSender javaMailSender;
@Autowired
private OrderRepository orderRepository;
@RequestMapping(value = "/orders/{id}/sendOrderEmailToSupplier")
public void sendOrderEmailToSupplier(@PathVariable("id") Long id, WebRequest request) throws MessagingException {...
Upvotes: 0
Views: 860
Reputation: 30399
@RepositoryRestController
deal with basePath only for resources which it manage. In other cases the path should not contain the "base".
If you want to build custom operations underneath basePath, you can use @BasePathAwareController
.
Upvotes: 4