Documentation uses incorrect annotation in the code example
@odrotbohm ci sta già lavorando.
Dal 22/1/2024.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Hi
Current documentation section that describes overriding default response handlers (https://docs.spring.io/spring-data/rest/reference/customizing/overriding-sdr-response-handlers.html) states multiple times that @RepositoryRestController annotation should be used:
Sometimes, you may want to write a custom handler for a specific resource. To take advantage of Spring Data REST’s settings, message converters, exception handling, and more, use the @RepositoryRestController annotation instead of a standard Spring MVC @Controller or @RestController. Controllers annotated with @RepositoryRestController are served from the API base path defined in RepositoryRestConfiguration.setBasePath, which is used by all other RESTful endpoints (for example, /api). The following example shows how to use the @RepositoryRestController annotation:
However in the code block after this text @BasePathAwareController annotation is used:
@BasePathAwareController
class ScannerController {
private final ScannerRepository repository;
ScannerController(ScannerRepository repository) {
repository = repository;
}
@GetMapping(path = "/scanners/search/producers")
ResponseEntity<?> getProducers() {
List<String> producers = repository.listProducers();
//
// do some intermediate processing, logging, etc. with the producers
//
CollectionModel<String> resources = CollectionModel.of(producers);
resources.add(linkTo(methodOn(ScannerController.class).getProducers()).withSelfRel());
// add other links as needed
return ResponseEntity.ok(resources);
}
}
Spring Data REST: 4.2.1
- Lingua principale
- Java
- Stelle
- 957
- Fork
- 570
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di spring-projects/spring-data-rest
-
Release 5.0.9 (2025.1.9)Apertatype: task
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
spring-projects/spring-data-rest#2624 ·
-
Release 5.1.3 (2026.0.3)Apertatype: task
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
spring-projects/spring-data-rest#2623 ·
-
Release 5.2.0 (2026.1.0)Apertatype: task
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
spring-projects/spring-data-rest#2622 ·
-
Merge patch drops linkable associations of existing array elements since 4.3Forse già presa @odrotbohm l’ha presa 27 giorni fa. Apertastatus: feedback-provided status: waiting-for-triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
spring-projects/spring-data-rest#2596 · 3 commenti · 1 assegnatario ·
-
Querydsl filtering silently ignores nested property paths since GH-2572Forse già presa @odrotbohm l’ha presa 27 giorni fa. Apertatype: regression
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
spring-projects/spring-data-rest#2579 · 1 reazione · 1 assegnatario ·
Tutte le issue di spring-projects/spring-data-rest
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
AllTheMods/AllTheModium#238 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
apache/stormcrawler#2264 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
commons-app/apps-android-commons#7115 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
objectionary/lints#1596 ·
I maintainer di solito rispondono entro 2 giorni