У меня контроллер выглядит так.
@RestController("/some")
public class SomeController {
@GetMapping(produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<?> read(...) {
...
}
@GetMapping(path = "{id:\\d+}", produces = ...)
public ResponseEntity<Some> readSingle(@PathVariable(name = "id") final int id) {
...
}
}
Контроллер работает на родителя.
curl http://.../some
Но дочерний ресурс возвращает то же самое с /some.
curl http://.../some/2 // returns the same with /some
Что я сделал не так?
My kingdom for a forward slash - я на днях, когда совершил ту же ошибку.
Отвечаю на свой вопрос.
Проблема в неправильной аннотации к классу.
@RequestMapping(path = {...})
@RestController
public class SomeController {
}
Это должен быть
/{id: \\ d +}