In case an EntityCallback is declared as lambda expression, the JVM does not expose any generics information about the target entity type the callback shall be applied to. This commit changes the callback lookup and processing so that in case the generics information is not detectable on the type, we fall back to the BeanDefinition's resolvable type (fed by the factory method's return type which carries the necessary reflection information). That generics information is then kept in the newly introduce EntityCallbackAdapter and the code inspecting the actual entity type for matches then uses the resolvable type held in that. Also, the actual callback invocation is done on the adapter's delegate.
Removed the ability of the discoverer to register EntityCallbacks by bean name as that was not used in the public API at all and it avoids duplicating the bean definition type detection. A couple of minor additional cleanups (records for cache key, methods static where possible and with lower visibility etc.)
Fixes#2812.
Use consistently domain type instead of introducing a new terminology to repository infrastructure.
Rename Kotlin variant of ParameterUnitTests to KParameterUnitTests to avoid duplicate classes.
See #2770
Original pull request: #2771
To support the binding of Class parameters to queries for declared query methods, we have to be able to differentiate them from Class parameters that are supposed to represent projections. We can do that by relating the declared Class' element type to the aggregate root type as a Class typed to that or any subtype of it will never trigger a projection by definition.
So far the Parameter(s) abstraction was solely created from a query method's Method. We now changed that for QueryMethod to forward the aggregate type detected on the RepositoryMetadata and consider it during the detection of dynamic projection parameters.
As a mitigating measure, we now also support @Param on Class-typed parameters to explicitly mark them for query binding. This is primarily to be able to add this support to the 2.7
The changes are built in a way that modules extending that mechanism will continue to work as is but with the intent to deprecate the previous API. Adapting extending code to the new APIs will automatically enable the support for bindable Class parameters on query methods.
Fixes#2770.
Original pull request: #2771
The version property used by Spring Boot to manage Spring Data modules pulled in transitively by the Spring Data BOM has changed from 'spring-data-releasetrain.version' to 'spring-data-bom.version'.
Closes#2766
Java8 bytecode may contain synthetic constructors that refer to anonymous classes which should not be inspected.
Eg. the following construct results in bytecode as listed further down below.
public enum Outer {
INSTANCE {
@Override
public Inner getInnerType() {
return Inner.STANDALONE;
}
},
public abstract Inner getInnerType();
}
synthetic Outer(java.lang.String arg0, int arg1, Inner$1 arg2)
See: #2744
Original pull request: #2746
Also update the type filter that would not mach types directly present in the given package.
Modify type contribution method to allow store specific override.
Closes: #2744
Original pull request: #2746
Added dedicated Lazy.toString() rendering the resolved value's ….toString() method but resorts to a constant [Unresolved] if it's not already resolved. An additional ….toString(Supplier<String>) allows to customize the fallback message if needed.
Fixes#2751.