mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Refine conversion service type check
Update fix to account for primitive types. See gh-28592
This commit is contained in:
parent
31b0264d94
commit
63fdd729f5
@ -42,6 +42,7 @@ import org.springframework.core.convert.ConverterNotFoundException;
|
||||
import org.springframework.core.convert.TypeDescriptor;
|
||||
import org.springframework.core.convert.converter.ConditionalGenericConverter;
|
||||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
@ -107,7 +108,7 @@ final class BindConverter {
|
||||
try {
|
||||
if (delegate.canConvert(sourceType, targetType)) {
|
||||
Object converted = delegate.convert(source, sourceType, targetType);
|
||||
if (targetType.getType().isInstance(converted)) {
|
||||
if (ClassUtils.isAssignableValue(targetType.getType(), converted)) {
|
||||
return converted;
|
||||
}
|
||||
}
|
||||
|
@ -40,4 +40,4 @@ public class WithPublicObjectToObjectMethod {
|
||||
return Optional.of(new WithPublicObjectToObjectMethod(value));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user