I have Spring Boot app and the following Controller
@Controller
@RequestMapping("/orders/{id}")
@ExposesResourceFor(Payment.class)
@RequiredArgsConstructor
public class PaymentController {
...
}
When I change
spring.data.rest.base-path=/api
then Controller reacts to requests without /api base path
curl -i -X PUT -H "Content-Type:application/json" -d "{ \"number\": \"1234123412341234\" }" http://localhost:8080/orders/1/payment
i.e. not http://localhost:8080/api/orders/1/payment
If I want to have /api base path, this would mean updating controller mapping to @RequestMapping("/api/orders/{id}")
which is not desirable because I hardcode configuration into code.
Is there any solution to this problem? Thanks