In case of an unresolvable generic parameter in TypeDiscoverer's getTypeArgument(…) we check for a generic super type for the given bound and fall back to Object in case we find a parameterized type.
RepositoryConfigurationDelegate allows to easily trigger repository BeanDefinitions to be registered independently of the client API (XML or annotation configuration support). Refactored the existing configuration base classes to use the newly introduced class. Removed defaulting of infrastructure components needed for Spring 3.1 compatibility.
The Hateoas(Pageable|Sort)HandlerMethodArgumentResolver now receive a UriComponents instance to inspect for existing query parameters. They then refrain from adding template variables for already present parameters. Slightly modified the way the sort parameters is appended to the pagination properties (although semantically equivalent).
We now handle an IllegalArgumentException being thrown in case we deal with a templated request mapping. We simply skip the attempt to eagerly resolve the base URI for the request and rely on the assembler being capable of resolving it itself or the user effectively providing a Link instances to one of the toResource(…) overloads.
PagedResourcesAssembler now adds a LinkTemplate to every PagedResources instance created and pulls the template variable information from the registered resolvers for Pageable and Sort.
Extended PageableResourceAssemblerArgumentResolver to create a special MethodParameterAwarePagedResourcesAssembler so that the assembler will take qualifier information into account when being injected into controller methods.
Upgraded to Spring HATEOAS 0.9.0.BUILD-SNAPSHOT to be able to benefit from new methods added to MethodParameters as well as the LinkTemplate class. Updated Sonargraph architecture definition to allow the web layer to access logging.
Turned the static cache of RepositoryInformations in RepositoryFactorySupport into a non-static one to avoid the instance from potentially surviving redeployments in web app scenarios.
We now also set a resource pattern on the ClassPathScanningCandidateComponentProvider to limit the scanning for custom implementations even more and thus avoid reading a lot of unnecessary class files.
The CDI extension now eagerly instantiates repository beans that are annotated with the newly introduced @Eager annotation. This is necessary to prevent the initialization procedure from interfering with potentially already executed business logic.
To achieve this CdiRepositoryExtensionSupport provides a new method registerBean(…) that has to be called by store implementations. The extension will then keep track of beans that require eager initialization and trigger it when the container has finished validation.
Changed the design of RepositoryBeanDefinitionBuilder to receive stable dependencies in the constructor and the moving parts as method arguments. This enables us to reuse the builder instance for the creation of all repository bean definitions. Most importantly that means we can use a single CachingMetadataReaderFactory instance which will avoid reading files again when looking for custom implementation classes.
Adapted clients for XML configuration and JavaConfig accordingly.
The auditing subsystem now supports the usage of JDK 8 date time types when running on Spring 4.0.1 or better. To achieve that switched to use the DefaultFormattingConversionService which registers the relevant converters needed. We also modified the SPI CurrentDateTimeProvider to return a Calendar instance as it carries time-zone information to be able to convert the instance into time-zone based JDK 8 date/time types.
This also allows us to make the use of JodaTime optional and only rely on it in case of the usage of Auditable or any of the JodaTime types used in the annotation based scenario. Added support to set LocalDateTime as well.
Removed the unnecessary type arguments for AuditingHandler so that the setter taking an AuditorAware<T> can be successfully wired against implementations other than AuditorAware<Object> with Spring 4. The type argument was superfluous anyway as internally the type wasn't referred to and the handler is not used on a by-type basis.
We're now replacing the sort parameter for the URI to be created instead of simply appending them to the source URI to prevent previously applied sort parameters to be taken forward.
The PageableHandlerMethodArgumentResolver and SortHandlerMethodArgumentResolver now transparently ignore invalid values provided for page number, size and sort. We fall back to ignore the invalid values (for sort) and fall back to the defaults where appropriate (page number and size).
Used and adapted test cases from pull request #48.
Previously we did only support ordering by a string or property path through Sort. In order to be able to express more type safe ordering expressions we introduce QSort as a subclass of Sort that is able to wrap QueryDSL OrderSpecifiers. To be able to separate the concerns of sorting via QueryDSL expressions better we introduce the AbstractPageRequest base class and QPageRequest as a special implementation that accepts a QSort or OrderSpecifiers for ordering.
Original pull request: #59.
We now resolve the domain and id-types eagerly within the constructor of AbstractRepositoryMetadata implementations to prevent a RepositoryMetadata instance to be created in an invalid state. Pulled-up repositoryInterface property to AbstractRepositoryMetadata.
Original pull request: #58.
Suppress deprecation warnings for GenericTypeResolver for now. Added Simple(Property|Association)Handler to ease working with untyped PersistentProperty instances without having to fall back to raw types. Polished Sonargraph architecture description.
Pulled up the method declaration from AnnotationBasedProperty as it's useful to be able to inspect a property for annotations being configured on it independently from whether the persistent mapping of it has been defined via annotations or not.
Expose isAnnotationPresent(…) as well to ease quick checks for an annotation.
The detection of CRUD methods in DefaultCrudMethods is now carried out in a more robust and predictable fashion. The exact algorithm is described in the JavaDoc.
Original pull request: #55.
Instead of creating a new DefaultRepositoryInformation for each call to getRepositoryInformation(…) we now actively cache the created instances per repository type and custom implementation class.
Spring 3.2.5 made AnnotationConfigUtils.processCommonDefinitionAnnotations(…) public so that we can call it directly instead of invoking it via reflection.
Basic infrastructure for supporting annotation based auditing configuration.
Introduces AuditingBeanDefinitionRegistrarSupport for store specific auditing configuration enhancements. An AuditorAware instance is wired into the Auditing handler automatically if it's present in the ApplicationContext. The auditorAwareRef attribute of the enabling annotation can be used to disambiguate in case multiple AuditorAware instances are present in the configuration.
Original pull requests: #26, #53.
Changed the initialization of repositories to default to eager with the ability to explicitly defer instantiation using @Lazy on the repository interface definition. In practice, the change in default shouldn't make any difference to most client projects as repositories are usually depended on by other application components so that the repositories never stay uninitialized.
To prevent ConcurrentModificationExceptions when iterating over PersistentEntities while further entity types are potentially added to the MappingContext we now return a immutable defensive copy of the current entity set.
As of Spring 4, the GenericTypeResolver is more consistent in detecting raw types. It now returns null for both resolveTypeArguments(Set.class, Set.class) as well as resolveTypeArguments(Set.class, Iterable.class). The latter returns an array of Object.class in 3.x.
As this shouldn't make a pratical difference to actual clients (as they need to check for null anyway, we loosen the test case to be able to build Spring Data Commons against both Spring 3 and Spring 4.
Some polishing in the version detection in integration tests. Moved the Servlet 3.0 dependency into the Spring 4 profile.
Some tests required an explicit dependency to servlet-api-3.x.
The GenericApplicationContext doesn't refresh automatically in Spring 4.x we thus we have to call refresh manually. Added a specific version of populators.xml for Spring 4.x since the jaxb2-marshaller element definition no longer renamed the contextPath attribute to context-path in 4.x.
Original pull request: #52.
Based on the discussion in SPR-11004 [0], the declaration of the PagedResourcesAssembler in HateoasAwareSpringDataWebConfiguration will not result in it being autowired using Spring 4.0 in certain circumstances. This change loosens the declaration so that it can be autowired into declarations that have specific generics declarations.
Original pull request: #51.
[1]: https://jira.springsource.org/browse/SPR-11004
We're now rejecting invalid constructor arguments handed to ClassTypeInformation, Part, PartTree and PropertyPath. Beyond that we skip the creation of a Part for an empty path segment, so that you don't end up with an invalid Part instance for a findAllByOrderByFooAsc.
When matching the save(Iterable<T>) method of CrudRepository for an entity implementing Iterable we accidentally determined CrudRepository.save(T) as target method if the entity type under consideration implements Iterable.
We now explicitly check for the parameter type not being Iterable when matching the domain type generics in matchesGenericType(…).
Previously a call to attributes.getBoolean(…) resulted in a NPE if a EnableXXXRepository annotation of a store (Neo4J in that case ) did not have the required property yet. With the added check we are safe again.
Added missing author tags where needed. Removed the template method to pick up the configuration from the RepositoryConfigurationSource interface as it's not needed from the outside.
Original pull request: #50.
We now optionally consider nested repository interfaces defined as inner-classes. This can be configured by setting the considerNestedRepositories property on EnableXXXRepository annotations or the consider-nested-repositories attribute to true - it defaults to false.
Original pull request: #50.
PropertyReferenceException now not only exposes the property not found but also the already resolved Property path to make it easier to understand what is causing the exception in the first place.
Introduced MappingContext.getPersistentPropertyPath(String, Class<?>) to allow looking up a PersistentPropertyPath from a plain dot-notated path expression (e.g. foo.bar.foobar). This removes the need to use a PropertyPath in case you really only want to look up plain path expressions and the additional functionality in PropertyPath (camel case traversal and interpreting _ as hard delimiter) is not needed or wanted.
In Repositories.getCrudInvoker(…) we now throw an IllegalArgumentException if we cannot find an appropriate repository for the given domain class. Previously it just blew up with a NullPointerException without a clear error message.
Original pull request: #46.
In order to find a keyword like "And" followed by a property name we now probe also for non Basic Latin characters in addition to just an uppercase letter. This is needed to support property-names with characters that don't have an upper or lowercase representation. This allows us to support finder methods like: findBy이름And생일OrderBy생일Asc(…).
Original pull request: #47.
PageRequest now actively prevents page sizes less than one. PageableHandlerMethodArgumentResolver falls back to default page size if it detects a page size less than one. It also rejects invalid default configuration using @PageableDefault.
When looking up the RepositoryFactoryInformation for a domain type we now make sure we look up the user type to not accidentally try to do so for a persistence provider generated proxy class for the original type. This prevents us from not finding PersistentEntity instances, Repository- or EntityInformation accidentally.