We now leniently add the TransactionProxy marker interface to the repository proxy to opt-out of any further transaction handling potentially applied through @EnableTransactionManagement or its XML equivalent.
The interface will be introduced in Spring 4.1.7 / 4.2 RC2 so we're reflectively adding it if present. Might be something we can think of making less indirect for Fowler once 4.1.7 has been released.
Spring Framework 4.2 is going to introduce support for CompletableFuture as return type for @Async methods. Support for Spring's ListenableFuture has already been supported in the framework 4.1. We've added the necessary infrastructure to allow these types as return types on repository methods, too.
Related tickets: SPR-13128.
Deprecate ObjectInstantiatorClassGenerator and provide a replacement
ClassGeneratingEntityInstantiator which doesn't retain a reference to
the context class loader.
Original pull request: #128.
On a last page the total handed into a PageImpl constructor might not necessarily fit the content as there's the change of an insertion or deletion between the calculated count and the retrieval of the content. We now leniently mitigate those differences if the page created is the last page of the result.
Related tickets: DATAJPA-728, DATACMNS-615.
We're now using ClassUtils.getDefaultClassloader() to make sure we adhere to any class loading tricks the framework might impose for domain type instantiation.
Introduced QueryMethodParameterConversionException to capture the context of a failed ConversionException to allow better error reporting.
Cleaned up test cases to not use deprecated API anymore.
We now always render both first and last links in case the page returned is navigable, which essentially means: whenever the result spans across more than one page. I.e. whenever either a next or prev link will be rendered, both first and last links are rendered, too.
Clients can still reason about the fact whether they're on the first or last page by the non-presence of prev (indicates you're on the first page) or next (indicates you're on the last page).
We now add first and last links to the PagedResources created in line with the appearance of the prev and next links. The PagedResourcesAssembler can be configured to enforce the rendering using setForceFirstAndLastRels(…).
In case we create a ParameterizedTypeInformation for a property we now also analyze the field-local generics information and add the discovered type mappings to the type variable map.
PagedResourcesAssembler now creates the self, prev and next links for a PagedResource to be canonical and not contain any template parameters. This is to make sure a client can not actually tweak the links and follow a link that's not strictly conforming to semantics of the rel.
When traversing nested property paths, AbstractMappingContext.getPersistentPropertyPath(…) previously used the raw actual property type. If the property path contains a reference to a generically typed property, this causes the deeper paths not being resolved correctly.
We now explicitly use the TypeInformation of the property to retain generics information while traversing the path.
In case the PageableHandlerMethodArgumentResolver was configured to use one-indexed parameters, it wasn't defaulting the lower bounds for the page number. This caused indexes out of the allowed bound submitted causing an invalid index handed tor PageRequest. We now apply better range shifting before the bounds are applied.
Instead of manually using Introspector.getBeanInfo(…) we now use Spring's BeanUtils.getPropertyDescriptors(…) to benefit from some caching of descriptor instances as well as advanced support for fluent setters, default methods etc.
Original pull request: #122.
Re-added index and defaulting information to the section that documents the currents state of web pagination. Removed legacy pagination sections as they're not really documenting the very legacy support (that would not even work anymore).
Added explicit anchors where missing.
RepositoryFactorySupport now exposes a setRepositoryBaseClass(…) to take a custom type that instances will be created reflectively for. This removes the need for a boilerplate repository factory and FactoryBean implementation to hook custom repository base class implementations into the infrastructure.
RepositoryFactorySupport now exposes a getTargetRepositoryViaReflection(…) method to allow sub-classes to create repository instances and consider customized repository base classes nonetheless. getTargetRepository(…) needs a tiny signature change which unfortunately requires imple
Fixed schema registration for version 1.8 schema. Added new XSD containing a base-class attribute on the <repositories /> element to customize the repository base class via XML.
Removed outdated section of how to create a custom base repository class from the reference documentation and replaced it with new simplified instructions.
Deprecated usage of factory-class attribute in configuration. Point users to newly introduced way of configuring a base class directly to avoid the need for a boilerplate repository factory and factory bean implementation.
DefaultRepositoryInformation now makes target class methods assignable before caching and returning them, so that they can always be invoked reflectively. Made this aspect part of the contract of RepositoryInformation.getTargetClassMethod(…).
Added a dedicated dependencies.adoc that outlines the usage of the Spring Data release train BOM as well as the way one would customize the release train to be used with Spring Boot.
Also, we now explicitly list the Spring Framework version the release requires.
DomainClassConverter as well as its internal ToEntity- and ToIdConverter implementations now actively refrain from matching if the source type is assignable to the target one to prevent unnecessary conversion attempts if the source value already actually is assignable to the target type.
Related ticket: DATACMNS-583.
Introduced a new overload for invokeQueryMethod(…) that uses a MultiValueMap with effective values of type Object so that clients can hand non-String values to the invocation. This is particularly useful if certain values shall trigger dedicated Converters registered in the ConversionService of ReflectionRepositoryInvoker.
Related tickets: DATAREST-502.
AnnotationBasedPersistentProperty now also caches the absence of properties that are expressed through accessors only. Previously the absence of a field caused us to skip the registration of the absence in the cache.
In case a RepositoryMetadata implementation alters the domain type the repository is actually handling, we still have to be able to find the repository based on the type originally declared in the repository.
The newly introduced getAlternativeDomainTypes() is now used by Repositories to register a repository for all types returned by that method, too, so that this reverse lookup still works.
Removed obsolete line-breaks in repositories documentation. Replace TWR worth with less ambiguous try-with-resources. Slight rewording. A few more details and fixed use of monospace font in return type reference.
Original pull request: #119.
Added section to repository documentation on how to use streams. Added an overview table for the generally supported return types for query methods.
Original pull request: #119.
Removed the ability to configure a custom SpElExpressionParser for now as it's not really part of the performance optimization. Polished assertions in SpelEvaluatingMethodInterceptor.
Original pull request: #118.
We now allow a SpelExpressionParser to be configured on the SpelAwareProxyProjectionFactory. This parser is then passed on to SpelEvaluatingMethodInterceptor. We also now eagerly pre-parse any SpEL expression in @Value annotations on methods of the projection interface. This avoids repeated evaluations during the actual method invocations.
Original pull request: #118.
Introduced @SpringDataWebConfigurationMixing that can be used on configuration classes that are supposed to contribute components to the Application context when @EnableSpringDataWebSupport is used.
SpringDataWebConfigurationImportSelector scans the org.springframework.data package for classes annotated with that annotation and adds them to the classes to be considered config classes.
TrasnactionalRepositoryFactoryBeanSupport now exposes a setEnableDefaultTransactions(…) which, if disabled, causes the TransactionalRepositoryProxyPostProcessor not to be registered and thus no default transactions to be applied.
Related tickets: DATAJPA-685.
Extracted DefaultMethodInvokingMethodInterceptor from RepositoryFactorySupport and register it within ProxyProjectionFactory if the code is running on Java 8.
Original pull request: #117.
Primarily intended to be used with Distance instances, we introduce a Range value type. Distance now has factory methods to create Range instances between two distances. To support this, Distance now implements comparable based on the normalized value of it.
Tiny refactoring in TypeDiscoverer to avoid code duplication between the lookup of parameter type information for constructors and methods.
Added stream to the list of supported query method prefixes. Allow Stream to be used as return type for paginating queries, too.
Renamed Java8StreamUtils to StreamUtils. Some additional JavaDoc.
Original pull request: #116.
A CloseableIterator abstracts the underlying result with support for releasing the associated resources via close() which can be transparently be used with try-with-resources in Java 7 since Closeable implements AutoCloseable from Java 7 on upwards. Added detector methods to QueryMethod to check whether the current method returns a Stream.
Introduced ReflectionUtils.isJava8StreamType to safely detect whether the given type is assignable to a Java 8 Stream. Introduced CloseableIteratorDisposingRunnable that can be registered as a cleanup action on a Stream.
Original pull request: #116.
The custom factory created to extend all repositories with additional behavior needs to return the type of the custom repository base class from getRepositoryBaseClass(…) to make sure the infrastructure can use it to inspect the CRUD methods correctly. Previously the documentations showed an interface being returned.
Code formatting in the example and inline code highlighting.