689 Commits

Author SHA1 Message Date
Mark Paluch
083393f6fa Defer MappingContext lookup in PersistentEntities to allow bean creation while MappingContext is being initialized.
Closes #2489
2025-06-11 09:14:47 +02:00
Oliver Drotbohm
09ded2d221 Move off deprecated API of Spring HATEOAS' AnnotationMappingDiscoverer.
Fixes GH-2490.
2025-06-04 20:11:38 +02:00
Oliver Drotbohm
47e103b2e8 Failure to look up repository metadata is now rejected with a 404 Not Found.
We now produce an HttpClientErrorException if ResourceMetadataHandlerMethodArgumentResolver fails for find metadata for a parsed repository key so that it automatically results in a 404 Not Found status code over a previous 500 Internal Server Error.

Fixes GH-2480
2025-05-20 15:09:13 +02:00
Jonathan Schnéider
6f20a571b1 Fix logger name in HalFormsAdaptingResponseBodyAdvice.
Co-authored-by: Moderne <team@moderne.io>
Fixes GH-2479.
2025-05-20 14:09:02 +02:00
Oliver Drotbohm
ca5f6a73e7 Produce IANA registered flavor of HAL media type by default.
Fixes GH-2454.
2025-05-16 12:34:46 +02:00
Mark Paluch
c0095a2a93 Adopt to changes in Spring Framework 7.
See #2449
2025-05-16 12:34:46 +02:00
Mark Paluch
efc5466578 Adopt to changes in Spring Framework 7.
See #2449
2025-05-16 12:34:45 +02:00
Mark Paluch
8cb01b103c Adopt to deprecation removals in Commons.
Closes #2437
2025-05-16 12:34:45 +02:00
Oliver Drotbohm
4f214bbbad Add support for offical, IANA-registered media type for HAL.
Fixes GH-2453.
2025-01-17 16:41:15 +01:00
Oliver Drotbohm
351010a905 Revert registration of WebMvc and HalExplorer modules with DevTools.
The original ticket (GH-2438) will be fixed downstream in Spring Modulith.

Fixes GH-2442.
2025-01-17 00:27:11 +01:00
Mark Paluch
a96862bb91 Extend license header copyright years to 2025.
See #2448
2025-01-08 10:04:48 +01:00
Oliver Drotbohm
c13850e73b Register WebMVC and HAL Explorer module with DevTools.
We now declare explicit Spring Boot DevTools configuration to include Spring Data REST WebMVC and HAL Explorer in the restart classloader to prevent proxying issues with package protected types.

Fixes GH-2438.
2024-12-11 15:44:22 +01:00
Oliver Drotbohm
e3308c584e Fix HttpMessageConverter lookup in PersistentEntityResourceHandlerMethodArgumentResolver.
We now ask the candidate converters whether they can read RepresentationModel instead of the domain type as that's the key type we register the individual ObjectMappers for in Spring HATEOAS.

Fixes: GH-2425.
Related ticket: GH-2419.
2024-11-15 08:39:11 +01:00
Oliver Drotbohm
0d0b26b8e0 Switch HttpMessageConverter lookup to test for domain type instead of PersistentEntityResource.
Fixes GH-2419.
2024-10-04 14:06:44 +02:00
Oliver Drotbohm
64ece65d8b Tweak HAL-FORMS setup to fall back on HAL as media type if no templates registered.
Fixes GH-2418.
2024-09-18 15:25:41 +02:00
Oliver Drotbohm
5c764464cf Properly append all superfluous elements to an array during merge patch.
Fixes GH-2357.
2024-01-19 18:24:20 +01:00
Oliver Drotbohm
41de5ad983 Tread entities nested in arrays like PUT for merge patch requests.
Fixes GH-2358.
2024-01-19 18:23:08 +01:00
Oliver Drotbohm
6cec482bb4 Fix broken merge of nested arrays.
Fixes GH-2350.
2024-01-15 17:41:36 +01:00
Mark Paluch
ae851d878f Extend license header copyright years to 2024.
See #2349
2024-01-02 14:42:06 +01:00
Oliver Drotbohm
667a49b3ab Polish Javadoc.
Related ticket GH-1947.
2023-12-15 12:33:48 +01:00
Oliver Drotbohm
30fdbd4949 Fix potential NullPointerException in ProjectionSerializer.
Fixes GH-1947.
2023-12-15 12:21:52 +01:00
Oliver Drotbohm
19c3179b31 Fix BasePathAwareHandlerMappingUnitTests.
Fixes GH-2338.
2023-12-13 17:39:25 +01:00
Oliver Drotbohm
5b05e59ce4 Runtime hints to include rest-messages files.
Fixes GH-2330.
2023-11-16 15:11:58 +01:00
Oliver Drotbohm
d6f0f3aa99 Properly merge non-entity arrays.
Fixes #2325.
2023-11-16 15:01:03 +01:00
Oliver Drotbohm
1fadf164ae Reinstate new object addition for collections in patch operations.
The removal of manual collection value appendance for primitives in the context of GH-2261 lead to complex object to be appended onto a collection not being deserialized at all. This deserialization is now reinstantiated with the value to be added looked up by reading the parent node into the collections element type using a JSON Pointer expression of /$propertyName/$index. This is done to make sure that @JsonDeserialize annotations on the property kick in for the deserialization of the individual elements.

We now also shortcut the entire merge algorithm for collections that are empty, contain primitives or enums.

Fixes GH-2287.
2023-08-30 21:34:46 +02:00
Mark Paluch
aa7262b038 Delombok code.
Closes #2286
2023-07-07 14:51:03 +02:00
Oliver Drotbohm
36300cfa1f Fix regression in PUT handling for empty nested documents.
The fix for #2174 introduced a bug for our PUT handling of nested documents in case the target object's field value is null as it would only apply the nested value if all Optionals were present. This is, of course not the case.

Fixes #2264.
2023-06-12 11:38:28 +02:00
Oliver Drotbohm
d6d8c50592 Avoid manually handling additional primitive elements in collection merging for PATCHes.
Fixes #2261.
2023-05-23 16:22:24 +02:00
Oliver Drotbohm
9020e1d10d Upgrade optional Jackson/JPA integration to Hibernate 6.
Fixes #2234.
2023-05-03 23:01:57 +02:00
Will Fleury
816ca84e70 Populate custom ExceptionHandlerExceptionResolver with ApplicationContext.
Fixes #2245.
Original pull request #2246.
2023-05-03 17:05:52 +02:00
Oliver Drotbohm
e4bca534bf Support to receive aggregate references as request parameters.
We now support using AggregateReference as type to bind request parameters taking URIs pointing to related aggregates. The default resolution will try to resolve the entire URI via UriToEntityConverter but one can also provide a function that can extract any part of the URI to be then resolved into either an identifier, aggregate instance or jMolecules Association against the ConversionService.

Fixes #2239.
2023-03-19 23:56:39 +01:00
Oliver Drotbohm
6d0034f15f Support for query methods returning a Slice.
Built on the the just introduced RepresentationModelAssembler implementations based on Slice in Spring HATEOAS and Spring Data Commons we now support returning a SlicedModel from the controller backing search resources ultimately triggering repository query methods.

The introduction triggered the refactoring to introduce RepresentationModelAssemblers (RMA) to remove the need for controllers inheriting from AbstractRepositoryController to access RepresentationModel assembly functionality. RMA acts as a facade for both Paged-/SlicedResourceAssembler as well as PersistentEntityResourceAssembler.

Fixes #2235.
2023-03-02 17:20:09 +01:00
Oliver Drotbohm
fb1924286a Use FormattingConversionService in JSON Patch binding.
We no pipe the Spring MVC ConversionService into the JSON Patch path binding. That usually is a FormattingConversionService at runtime and also supports the conversion of dates.

The ConversionServices is configured into the BindContext(Factory) we use for binding. The context then exposes the EvaluationContext set up with it.

Fixes #2233.
2023-02-21 18:43:19 +01:00
Oliver Drotbohm
d02d1bb0c1 Support for returning response bodies on deletion of item resources.
RepositoryRestConfiguration now allows to configure to return a response body for the deletion of item resources. The controller implementation follows the same patter we have already established for creation and updates: unless explicitly enabled or disabled we now consider the presence of an accept header as indicator of whether a response body should be rendered.

This could be a "breaking" change for clients having explicitly expected 204 until now even for requests with an Accept header. If that's an issue, those should either explicitly disable the setting, do not submit an Accept header or loosen their expectations to expect either 200 or 2xx as indicator of success in general.

Fixes #2225.
2023-02-21 17:25:28 +01:00
Oliver Drotbohm
7c0fc837a3 Register MVC validator with Spring Data REST HandlerAdapter.
Fixes: #967.
Original pull request: 2108.
2023-02-21 15:46:08 +01:00
zhengchalei
890111f06f Fix doc link end label in ResourceStatus.
Fixes #2139
2023-02-21 14:19:46 +01:00
Oliver Drotbohm
6c4f57f31a Avoid obsolete inspection of DefaultedPageable.
The instance can never be null and thus we don't actually have to check for that.

Fixes #2222
2023-02-21 14:14:38 +01:00
Oliver Drotbohm
b65e0c9118 Adapt to renamed properties by using MappedProperties in association deserialization.
Revert the changes that employed manual annotation lookup as that would cause invalid associations of fields and accessor methods for properties shadow renamed. Instead, we now use MappedProperties that already contains a mapping between the Jackson field names and Sprign Data property names.

Fixes: #2165
2023-02-21 13:26:14 +01:00
Lars Vierbergen
5335fe61e9 Fix mapping URIs to @JsonProperty annotated associations
Normally, when creating and updating (POST/PUT) an entity via the REST endpoints, you can use the URL of the relation target. (e.g.: send `{"package": "/packages/1"}` when `package` is a JPA `@OneToOne` relation).

Now this also takes into account when the JPA relation is annotated with `@JsonProperty` to change the serialized name.

Add unit tests for linkable associations.

Issue: #2165
2023-02-21 13:26:08 +01:00
Oliver Drotbohm
f18491f722 Properly deep-merge nested documents on PUT.
This is needed to consider read-only properties within those objects as those would otherwise get overridden.

Fixes: #2174
2023-02-21 10:36:38 +01:00
Oliver Drotbohm
0db1adadd0 Register StdValueInstantiator._constructorArguments for reflection.
The field is looked up by reflection in ValueInstantiatorCustomizer.

Fixes #2213.
2023-01-20 16:35:30 +01:00
Oliver Drotbohm
1bfa83cb73 Register per-repository pattern for observability purposes.
The standard Spring MVC observability integration registers the plain request pattern for observations. For our repository controllers that would result in one pattern registered for all individual repository resources (e.g. /{repository}/{id} etc.). However, the insights users would like to gain rather follows the individual repositories exposed. That's why we have so far exposed repository specific path pattern (/myrepo/{id}) via a custom request attribute. To adhere to the new observability integration of Spring Framework 6, we need to expose that particular pattern on the ServerRequestObservationContext, too.

Fixes #2212.
2023-01-09 15:31:57 +01:00
Mark Paluch
f0e86b9a17 Extend license header copyright years to 2023.
See #2211
2023-01-02 09:53:37 +01:00
Christoph Strobl
6f68fe814f Add Nullable annotation to parameter of overridden equals method.
Closes: #2196
Original pull request: #2197
2022-12-02 11:16:15 +01:00
Christoph Strobl
b3e8489085 Added AOT metadata.
We now register @BasePathAwareController instances for class proxy generation. Also, we scan the packages of repository definitions for projection interfaces to register reflective access for them.

Fixes #2183.
2022-10-27 11:50:57 +02:00
Oliver Drotbohm
5d0687d1a1 Improve JSON Patch implementation.
Refactor JSON Patch application implementation to improve the property detection for which values are supposed to be set.

Fixes #2177.
2022-09-19 10:21:19 +02:00
Oliver Drotbohm
23dfeafee4 Add explicit qualifier names to references to RepositoryInvokerFactory in RepositoryRestMvcConfiguration.
Fixes #2161.
2022-07-15 14:01:11 +02:00
Oliver Drotbohm
1205ef1eb8 Polish annotation attribute aliasing in RepositoryRestController.
Related ticket: #2157.
2022-07-14 17:45:26 +02:00
Oliver Drotbohm
753886fa2c Forward StringValueResolver to DelegatingHandlerMappings targets.
RepositoryRestMvcConfiguration now implements EmbeddedValueResolver to forward the StringValueResolver given to both BasePathAwareHandlerMapping and RepositoryRestHandlerMapping.

Related ticket: #2157.
2022-07-13 23:47:36 +02:00
Mark Paluch
070d284e69 Upgrade to Hibernate 6.
Introduce bytebuddy exclusions to avoid clashes with Mockito-provided byte buddy versions. Extend version range in Jackson Hibernate module registrar.

Closes #2158
2022-07-13 08:54:26 +02:00