@@ -9,7 +9,7 @@ The following example shows how to use the `@RepositoryRestController` annotatio
|
||||
====
|
||||
[source,java]
|
||||
----
|
||||
@BasePathAwareController
|
||||
@RepositoryRestController
|
||||
class ScannerController {
|
||||
|
||||
private final ScannerRepository repository;
|
||||
@@ -47,7 +47,7 @@ class ScannerController {
|
||||
|
||||
`CollectionModel` is for a collection, while `EntityModel` -- or the more general class `RepresentationModel` -- is for a single item. These types can be combined. If you know the links for each item in a collection, use `CollectionModel<EntityModel<String>>` (or whatever the core domain type is rather than `String`). Doing so lets you assemble links for each item as well as for the whole collection.
|
||||
|
||||
IMPORTANT: In this example, the combined path is `RepositoryRestConfiguration.getBasePath()` + `/scanners/search/listProducers`.
|
||||
IMPORTANT: In this example, the combined path is `RepositoryRestConfiguration.getBasePath()` + `/scanners/search/producers`.
|
||||
|
||||
[[customizing-sdr.aggregate-references]]
|
||||
== Obtaining Aggregate References
|
||||
@@ -60,7 +60,7 @@ All you need to do is declare an `@RequestParam` of that type and then consume e
|
||||
|
||||
[source,java]
|
||||
----
|
||||
@BasePathAwareController
|
||||
@RepositoryRestController
|
||||
class ScannerController {
|
||||
|
||||
private final ScannerRepository repository;
|
||||
@@ -93,7 +93,7 @@ In case you are using jMolecules, `AssociationAggregateReference` also allows yo
|
||||
While both of the abstraction assume the value for the parameter to be a URI matching the scheme that Spring Data REST uses to expose item resources, that source value resolution can be customized by calling `….withIdSource(…)` on the reference instance to provide a function to extract the identifier value to be used for aggregate resolution eventually from the `UriComponents` obtained from the URI received.
|
||||
|
||||
[[customizing-sdr.overriding-sdr-response-handlers.annotations]]
|
||||
== `@RepositoryRestResource` VS. `@BasePathAwareController`
|
||||
== `@RepositoryRestController` VS. `@BasePathAwareController`
|
||||
|
||||
If you are not interested in entity-specific operations but still want to build custom operations underneath `basePath`, such as Spring MVC views, resources, and others, use `@BasePathAwareController`.
|
||||
If you're using `@RepositoryRestController` on your custom controller, it will only handle the request if your request mappings blend into the URI space used by the repository.
|
||||
|
||||
Reference in New Issue
Block a user