Performance improvements in ReactiveWrappers and ConvertingPropertyAccessor.
We now cache whether types are reactive wrappers and bypass the ConversionService for assignable primitive values. Closes #2546
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@ import org.springframework.data.mapping.PersistentPropertyAccessor;
|
||||
import org.springframework.data.mapping.PersistentPropertyPath;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* {@link PersistentPropertyAccessor} that potentially converts the value handed to
|
||||
@@ -103,7 +104,7 @@ public class ConvertingPropertyAccessor<T> extends SimplePersistentPropertyPathA
|
||||
|
||||
return (S) (source == null //
|
||||
? null //
|
||||
: type.isAssignableFrom(source.getClass()) //
|
||||
: ClassUtils.resolvePrimitiveIfNecessary(type).isAssignableFrom(source.getClass()) //
|
||||
? source //
|
||||
: conversionService.convert(source, type));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user