You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature regression : Spring Data REST controller must not use @RequestMapping on class level as this would cause double registration with Spring MVC #2087
@RequestMapping is now only allowed on method level but that isn't an valid option for method on an abstract controller.
@RepositoryRestController
@RequestMapping("/api/widgets")
public class WidgetController extends BaseControler {
// ...
}
public class BaseControler {
@GetMapping("/get")
public ResponseEntity<String> get() {
return ResponseEntity.ok().body(....);
}
}
Proposition of fix =>
Add a field "path/value" on the annotation @RepositoryRestController to be able to set a root path at class level.
@RepositoryRestController("/api/widgets")
@RequiredArgsConstructor
public class WidgetController extends BaseControler {
// ...
}
public class BaseControler {
@GetMapping("/get")
public ResponseEntity<String> get() {
return ResponseEntity.ok().body(....);
}
}