Optimize checks for java classes in Binder
Closes gh-13567
This commit is contained in:
parent
7baa41f148
commit
ba46e77169
|
|
@ -45,7 +45,6 @@ import org.springframework.core.convert.ConverterNotFoundException;
|
|||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.format.support.DefaultFormattingConversionService;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* A container object which Binds objects from one or more
|
||||
|
|
@ -354,8 +353,7 @@ public class Binder {
|
|||
if (resolved.isPrimitive() || NON_BEAN_CLASSES.contains(resolved)) {
|
||||
return true;
|
||||
}
|
||||
String packageName = ClassUtils.getPackageName(resolved);
|
||||
return packageName.startsWith("java.");
|
||||
return resolved.getName().startsWith("java.");
|
||||
}
|
||||
|
||||
private boolean containsNoDescendantOf(Stream<ConfigurationPropertySource> sources,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import org.springframework.boot.context.properties.source.ConfigurationPropertyS
|
|||
import org.springframework.boot.context.properties.source.IterableConfigurationPropertySource;
|
||||
import org.springframework.core.CollectionFactory;
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* {@link AggregateBinder} for Maps.
|
||||
|
|
@ -199,8 +198,7 @@ class MapBinder extends AggregateBinder<Map<Object, Object>> {
|
|||
private boolean isScalarValue(ConfigurationPropertySource source,
|
||||
ConfigurationPropertyName name) {
|
||||
Class<?> resolved = this.valueType.resolve(Object.class);
|
||||
String packageName = ClassUtils.getPackageName(resolved);
|
||||
if (!packageName.startsWith("java.lang") && !resolved.isEnum()) {
|
||||
if (!resolved.getName().startsWith("java.lang") && !resolved.isEnum()) {
|
||||
return false;
|
||||
}
|
||||
ConfigurationProperty property = source.getConfigurationProperty(name);
|
||||
|
|
|
|||
Loading…
Reference in New Issue