MappedProperties now exposes a factory method that uses the Jackson introspector for serialization (instead of deserialization) which now also includes read-only properties. Previously, read-only ones were not considered as they are excluded from the metadata if it is looked up for deserialization.
We now support adding a to a collection via JsonPatch expressions by using the collection's size as target index. Contrary to paths pointing to existing collection elements we cannot determine the type of the object to be created. Thus, we fall back to the common element type of all existing collection elements. We also reject indexes pointing to elements with an index greater than the current collection's size.
DomainObjectReader now aborts the recursive merges in case it encounters an entity that's described as @Immutable (just introduced in Spring Data Commons).
Fixed some generics and removed DomainObjectMerger as it's unused.
Related ticket: DATACMNS-1322.
Adapted RepositoryRestMvcConfiguration to now create a shared fallback ObjectMapper and avoid to register it as Spring Bean. Adapted test cases that previously were relying on such a bean being present.
Adapted test cases to verify on the correct ALPS document structure (see spring-projects/spring-hateoas#665).
Fixed @since tag in new converter implementation as we're going to backport the fix to Kay. Simplified converter setup in RepositoryRestMvcConfiguration to expose less API until someone actually requests access.
Original pull request: #290.
We now provide and configure a converter for String to LdapName conversion so Spring Data LDAP can be used with Spring Data REST without further configuration.
Original pull request: #290.
ResourceMetadataHandlerMethodArgumentResolver.supports(…) now properly checks for ResourceMetadata. It previously checked for RepositoryInformation which is probably a left-over from a previous state of the codebase and has been unnoticed so far as the class is only used as a direct dependency of other HandlerMethodArgumentResolvers.
ExposureConfiguration exposes methods to register AggregateResourceHttpMethodsFilter and AssociationResourceHttpMethodsFilter (both applied by type or globally) to customize the supported HTTP methods by collection, item and association resources. It also provides shortcuts for common use cases like disabling PUT for item resources etc.
We now recommend to implement RepositoryRestConfigurer directly as its declared methods are now default methods. We also introduced a static factory method to easily create a configurer to customize RepositoryRestConfiguration via a Lambda expression.
Moved test case setups that use that deprecated API to the new one.
DelegatingHandlerMapping now implements MatchableHandlerMapping by selecting the a delegate based on the already implemented algorithm and then invoking the ….match(…) method in case the selected one is a MatchableHandlerMapping in turn.
Refactored the internals a bit to be able to reuse the selection algorithm from both ….getHandler(…) and ….match(…).
The default exposure of repository methods is now controlled via RepositoryRestConfiguration.setExposeRepositoryMethodsByDefault(…). That allows us to remove the additional API from RepositoryDetectionStrategy as the mere detection is an orthogonal topic.
Also added RepositoryRestConfiguration.disableDefaultExposure() to set the RepositoryDetectionStategy to ANNOTATED and disables default method exposure in one go. That can be exposed via a Spring Boot configuration property downstream.
Removed Lombok constructor and accessor generation to avoid having to deal with the changed default in Lombok 1.16.20 not generating @ConstructorProperties by default anymore.
Spring Framework 5.0.2 changes the default for the Allow-Credentials header to false. We now adapted our test case to that and also drop the expectation to see the request URL in the Allow-Origin header as that is only returned if Allow-Credentials is true, which it now isn't by default.
Significantly refactored the way that patch path expressions are handled and evaluated. The new design is centered around SpelPath that is aware of the original path as well as the derived SpEL expression. That SpelPath then requires clients to bind it to a type so that the original path can be validated (and rejected if invalid) and provide API to read, set, copy and move values backed by the original path. Both SpelPath and TypedSpelPath instances are cached to avoid repeated creation.
PatchOperation implementations now provide more fluent factory methods, in some cases via intermediate builders. Removed a lot of obsolete code that created JsonNodes from a list of PatchOperations as we don't actually use that functionality anywhere. Removed obsolete generics where possible.
We now inspect the user class of the given bean type in BasePathAwareHandlerMapping.isHandler(…). We can't use AnnotationUtils as @RepositoryRestController is also annotated with @BasePathAwareController but must not be handled by this mapping.
Previously the SpEL expresssion created from JSON Patch path expressions were executed without double checking whether these paths actually exist on the target object in the first place. This is now in place.
Association links now explicitly indicate projections are available in case there are projection types registered for the association target type.
Original pull request: #273.
Switched from ProxyProjectionFactory.setResourceLoader(…) to ….setBeanClassLoader(…). Some generics polishing and removal of obsolete warnings supression.
We now also catch SpelEvaluationException in the attempt to set a null value for an expression as Spring 5 now reports a failed attempt (e.g. if the target type is not nullable) using that type whereas Spring 4.3 threw a NullPointerException.
Fixed the setup of our custom ExceptionHandlerExceptionResolver to conclude with a call to afterPropertiesSet() to make sure it's properly initialized.
We now expose the constructor that takes a RelProvider in RepositoryResourceMappings so that clients can tweak the default relation names. Changed the order of constructor parameters of (previously) non-public constructors for consistency.
The RelProvider to be used with the mappings can now be configured via RepositoryRestConfiguration and defaults to the EvoInflector based one.
When a PATCH call using JSON Patch tried to append an item to an empty collection, it previously failed to look up the type to unmarshal the incoming payload to. We now inspect the declared types on the wrapped object's property to determine that type for append operations.
Also, an uninitialized collection is now initialized using Spring's CollectionFactory.
Additional cleanups in QuerydslAwareRootResourceInformationHandlerMethodArgumentResolver to make sure a QuerydslRepositoryInvokerAdapter is only applied if the QuerydslPredicateBuilder actually exposes a predicate. Extracted a couple of methods to make sure the mapping pipeline reads nicely.
We now consider the base URI when resolving CORS configuration from repository interfaces. The base URI is now stripped from the request. Previously the base URI was not stripped from the request and was used to determine an exported resource.
So far, we handed the plain instance deserialized from the request body to the repository to persist it. That caused issues in PUT for create scenarios where the URI contains the identifier to be used for the aggregate to create and identifier generation being used in the backend. In that case the identifier submitted was never considered and subsequent requests would've created new instances, effectively breaking the idempotent nature of PUT.
We now make sure the backend identifier derived from the resource is set on the aggregate instance about to be created, so that backend can either accept that situation (new entity + manually defined identifier) or reject it (in case it insists on identifier generation).
Previously, when a request was sending an Accept header of some arbitrary *+json, the request was routed through the controllers and might have ended up producing a PersistentEntityResource that was then mapped using an uncustomized Jackson ObjectMapper. That has caused a huge JSON object to be unfolded which is highly undesirable.
We now only answer JSON requests to repository resources that contain an Accept header with any of the explicit JSON media types we got registered.
Tweaked the setup of the ExceptionHandlerExceptionResolver to not expose a bean in the first place but rather use the Spring MVC provided callbacks to register custom ones. We also now make sure MVC is bootstrapped property for integration tests through the inclusion of DelegatingWebMvcConfiguration.