@Configuration
+ class spring-data-rest-webmvc artifact to your compile-time
+ dependencies: spring-data-rest-webmvc artifact to your compile-time
+ dependencies: @Import annotation or you can subclass it and override any of
+ the configureXXX methods to add your own configuration to
+ that of Spring Data REST.@Configuration
- class (or subclass it and perform any required manual configuration), and map some URLs to be managed by Spring
- Data REST.
- spring-data-rest-webmvc
- artifact to your compile-time dependencies:
-
- spring-data-rest-webmvc
- artifact to your compile-time dependencies:
-
- @Import
- annotation or you can subclass it and override any of the
- configureXXX
- methods to add your own configuration to that of Spring Data REST.
- configureConversionService
- method and add your own converters. To convert a query parameter to a complex object, for instance, you would
- want to register a converter for
- rest-shell:
-
- Link.
- CrudRepository
- method.
- | Verb | -Method | -
|---|---|
- GET
- |
-
- CrudRepository<ID,T>.findOne(ID id)
- |
-
- POST
- |
-
- CrudRepository<ID,T>.save(T entity)
- |
-
- PUT
- |
-
- CrudRepository<ID,T>.save(T entity)
- |
-
- DELETE
- |
-
- CrudRepository<ID,T>.delete(ID id)
- |
-
links. That property is an array of objects that take the form of something resembling an
- atom:link
- element in the
- Atom XML namespace.
- application/x-spring-data-compact+json
- by placing this in the request
- Accept
- header. Rather than inlining the entities, this content-type provides a link to each entity in the
- page, to specify page number
- limit, to specify how many results to return on a page, and
- sort
- to specify the query method parameter on which to sort. To change the names of the query parameters, simply call
- the appropriate method on
- p, the limit parameter to
- l, and the sort parameter to
- q:
-
- .dir
- and setting that value to either
- asc
- ordesc. The following would use the
- findByNameStartsWith
- query method defined on the
- /orders. The path is derived from the uncapitalized,
+ pluralized, simple class name of the domain class being managed. It also
+ exposes a an item resource for each of the items managed by te repository
+ under the URI template 200 OK - for plain GET
+ requests.201 Created - for POST and
+ PUT requests that create new resources.204 No Content - for PUT,
+ PATCH, and DELETE requests if the
+ configuration is set to not return response bodies for resource
+ updates
+ (RepositoryRestConfiguration.returnBodyOnUpdate). If
+ the configuration value is set to include responses for
+ PUT, 200 OK will be returned for updates,
+ 201 Created will be returned for resource created
+ through PUT.GET to the root
+ URL:GET and
+ POST. All other HTTP methods will cause a 405 Method
+ Not Allowed.GETpage - the page number to access (0 indexed,
+ defaults to 0).size - the page size requested (defaults to
+ 20).sort - a collection of sort directives in the
+ format ($propertyname,)+[asc|desc]?.405 Method Not Allowed - if the
+ @RestResource(exported = false)) or is not
+ present in the repository at all.search - a search
+ resource if the backing repository exposes query
+ methods.POST405 Method Not Allowed - if the
+ @RestResource(exported = false)) or is not
+ present in the repository at all.GET,
+ PUT, PATCH and DELETE unless
+ explicit configuration prevents that (see below for details).GET405 Method Not Allowed - if the
+ @RestResource(exported = false)) or is not
+ present in the repository at all.PUT405 Method Not Allowed - if the
+ @RestResource(exported = false)) or is not
+ present in the repository at all.PATCHPUT but only applying values sent with
+ the request body.405 Method Not Allowed - if the
+ @RestResource(exported = false)) or is not
+ present in the repository at all.DELETE405 Method Not Allowed - if the
+ @RestResource(exported = false)) or is not
+ present in the repository at all.400 Bad Request - if multiple URIs were given
+ for a to-one-association.405 Method Not Allowed - if the association
+ is non-optional.GET only.GETGET only.GETpage - the page number to access (0 indexed,
+ defaults to 0).size - the page size requested (defaults to
+ 20).sort - a collection of sort directives in the
+ format ($propertyname,)+[asc|desc]?.rel
- and
- href
- property. These objects will appear in an array under an object's
- links
- property. These objects are meant to provide a user agent with the URLs necessary to retrieve resources related to
- the current resource being accessed.
- href.
- Issue a
- get
- in the
- rest-shell
- to see an example of links.
-
- @ManyToOne,
- @OneToOne, or other relationship annotation. If using Spring Data MongoDB, one would place a
- @DBRef
- annotation on a property to denote its special status as a reference to other entities. In the example project,
- the
- siblings
- property. If you
- get
- the resource of a
- siblings
- property, the link to follow to get the related
- Accept
- type specified in the HTTP request.
- Accept type specified in the
+ HTTP request. configureJacksonObjectMapper
- method. That method will be passed an
- configureJacksonObjectMapper method. That method will
+ be passed an setupModule
- method implementation, do something like the following:
- setupModule method implementation,
+ do something like the following:| Command | -Description | -
|---|---|
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- --follow true
- is set, then follow any redirects automatically. If
- --output filename
- is set, output the the response into the given file.
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-
|
- |
-
- |
-