Add findAllById, deleteAll to CoroutineCrudRepository.
Keep CoroutineCrudRepository somewhat in sync with ReactiveCrudRepository by adding based methods for those accecpting Publisher.
Also add some test.
Update License Headers of Kotlin files and fix some warnings. Switch to kotlin-test-junit5.
Original pull request: #415.
Added ClassUtils.ifPresent(…) to conditionally call back a Consumer<Class> if a class is available from the given ClassLoader. Extract isSuspend(…) method into KotlinReflectionUtils. Deprecate Kotlin-related methods in our ReflectionUtils as parts are available from Spring Framework directly.
Rename CoCrudRepository to CoroutineCrudRepository and CoroutineSortingRepository. Add tests for KotlinReflectionUtils to test calls without Kotlin dependencies.
Original pull request: #415.
We now support Kotlin Coroutines repositories backed by reactive repositories. Coroutine repositories can either invoke reactive query methods or implemented methods that are backed either by methods returning a reactive wrapper or that are native suspended functions.
Exclude Coroutines Continuation from bindable parameters and name discovery and do not unwrap results for suspended functions returning a reactive type.
interface CoroutinesRepository : CoroutineCrudRepository<User, String> {
suspend fun findOne(id: String): User
fun findByFirstname(firstname: String): Flow<User>
}
Original pull request: #415.
We now ship and use a PropertyAccessor implementation by default that will fall back to use the persistence constructor and creating a new instance to "set" a property. This allows completely immutable types, ommitting previously needed wither methods, e.g. to populate automatically generated identifier values.
This is implemented by using the EntityInstantiator available and a ParameterValueProvider that returns the value of the properties of the current instance but replacing the one for the value to be set. This requires moving EntityInstantiators, the EntityInstantiator SPI as well as all existing implementations (reflective, class generating and the Kotlin one) into the mapping.model package. Legacy instances stay around in deprecated form to avoid breaking existing clients (other store modules as well as user implementations of EntityInstantiator).
The newly introduced implementations stay package protected as their sole users are now colocated in the same package. Access from the legacy types is handled via InternalEntityInstantiatorFactory, which is introduced in deprecated from for removal alongside the actual deprecations.
We're adding search as prefix for derived repository query methods to improve readability when a Spring Data module is integrated with a search engine. Now it's possible to create a `search…By…` query like `searchByFirstname`.
QuerydslPredicateArgumentResolver now properly handles predicate lookups that result in null values. The semantics of a handler method parameter of type of Querydsl's Predicate have been tightened to always see a non-null Predicate by default. Users that want to handle the absence of predicates explicitly can opt into seeing null by annotating the parameter with @Nullable or use Optional<Predicate>.
QuerydslPredicateBuilder now consistently returns null in case the original parameter map is entirely empty or consists of only keys with empty value arrays as empty form submissions do. This partially reverts the work of DATACMNS-1168, which moved into the direction of returning a default Predicate value for empty maps in the first place. That however prevents us from producing empty Optionals.
Related tickets: DATACMNS-1168.
Moved off deprecated API for annotation introspection. Move application of primary flag for bean definitions from RepositoryConfigurationDelegate to RepositoryBeanDefinitionBuilder.
We now expose human readable resource descriptions based on RepositoryConfiguration and RepositoryConfigurationSource. Spring Boot uses those to describe problematic bean definitions in case it detects errors in the application setup.
We now log the module name during repository scanning to indicate the used module and to avoid confusion about duplicate initialization when a single module is used that supports both, imperative and reactive repositories.
We now render depending on the projection-collection attribute the appropriate return type that is used for example code to inject also alternate return types such as Mono/Flux for reactive module documentation.
We now return the content length as size of a Chunk if no Pageable has been used to create a Chunk. This makes the usage of a Chunk without an explicit Pageable work just like it was requested with the size of the given content.
We now skip PersistentPropertyPath instances pointing to auditing properties for which the path contains a collection or map path segment as the PersistentPropertyAccessor currently cannot handle those. A more extensive fix for that will be put in place for Moore but requires more extensive API changes which we don't want to ship in a Lovelace maintenance release.
Related tickets: DATACMNS-1461.
We now catch the MappingException produced by trying to set auditing property paths containing null intermediate segments and ignore those. A less expensive (non-Exception-based) approach is going to be introduced for Moore as it requires API changes to the property path setting APIs.
Related tickets: DATACMNS-1438.
PropertyAccessorClassGenerator now tries to look up the class to be generated first to potentially reuse an already existing one and avoid the recreation and registration of a same class which would trigger a Linkage error as a classloader cannot hold two classes with the same name.
The root of the problem is in the fact that the accessor instances are held in per instance caches in EntityInstantiators, so that multiple of those might try to create the same accessor class for a given domain type.
Previously, a module not exposing any entity identifying annotations would have claimed a repository definition and potentially overrode the bean definition of another store that was the proper claim in the first place. We have now changed this to abstain from a claim of the interface.
We' also tweaked the log output in the following cases:
1. If the module neither returns an identifying type nor entity identifying annotations, we now log a warning that a module does not support a multi-module setup and answer all assignment requests with false.
2. The info level warning indicating an interface has been dropped now reports which annotations or interface base types to use.
Original pull request: #411.
Related tickets: spring-projects/spring-boot#18721
We now elevate the primary annotation from the scanned repository bean definition to the one created for the repository factory. This previously got lost as the former is hidden behind the RepositoryConfiguration interface that previously didn't expose the primary nature of the underlying bean definition.
Original pull request: #410.
Add ReactivePageableHandlerMethodArgumentResolver and extract shared code from imperative PageableHandlerMethodArgumentResolver into PageableHandlerMethodArgumentResolverSupport.
Original pull request: #264.