Removed the rejecting check for collections and maps and solely rely on the evaluation of the actual type for the ….isEntity() decision in AbstractPersistentProperty. This will cause collection and map properties also being inspected for persistent types as soon as the owner type gets added to the mapping context.
Previously we directly threw a MappingException in MappingContext.getPersistentEntity(TypeInformation) when the MappingContext was in strict mode and we were given a TypeInformation for which we didn't have a PersistentEntity already.
We now first check whether we should actually create a PersistentEntity for the given TypeInformation if no PersistentEntity is available, before throwing a MappingException - if we should not then we simply return null (e.g. for simple types like Integer or Double).
Original pull requests: #66, #71.
Added array checks to AbstractRepositoryMetadata.getReturnedDomainClass() to detect array component types. QueryMethod now considers methods returning arrays to be collection query methods.
Previously the map value type resolving algorithm checked the value type to be of type Map again to shortcut the resolution. We now weakened this to an assignment check and eagerly resolve the generic type if its bound on exactly that level already. If no concrete type argument can be found, we fall back to the general generics resolution mechanism.
The changes in 899cf25 causes Repositories not finding any repository instances in case the lookup of beans by type for RepositoryFactoryInformation if the initialization causes as cyclic reference. Even worse, we might run into cases in which the attempt to access the beans by type causes transitive object creation which results in a successful lookup on a second attempt.
This is effectively caused by the catch-block in DefaultListableBeanFactory.getBeansOfType(…) which registers the suppressed exception as the method is used for lookup the beans for injection points with Lists and Maps.
We now explicitly look for bean names first and access the bean by name afterwards, which guarantees the exception to be thrown if it occurs. This will reveal the underlying issue and let user potentially deal with it. It's generally recommended to refer to Repositories in a very lazy fashion (using Provider<T>, ObjectFactory<T> or @Lazy on the injection point as of Spring 4) to avoid creating circular dependencies through by-type-lookups.
We now eagerly populate the repository factory information in Repositories to provide a read only view on the discovered repository information. Previously lookup operations could also change some maps that held information about the until then discovered repository meta data which could lead to ConcurrentModifcationExceptions in multi-threaded environments. Since we don't allow any modification after construction this won't happen anymore.
We also cache the computed RepositoryMetadata in RepositoryFactoryBeanSupport.
Original pull request: #63.
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.
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'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.
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.
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.
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.
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.
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(…).
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.
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.
Added appropriate test to PartTreeUnitTests to check whether the regular expression in PartTree doesn't accidentally finds keywords in property expressions.