Browse Source

Merge pull request #16974 from izeye

* pr/16974:
  Use actual resolvedType when checking Binder cache
pull/17068/head
Phillip Webb 7 years ago
parent
commit
b1e90fdca9
  1. 8
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/JavaBeanBinder.java

8
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/JavaBeanBinder.java

@ -192,12 +192,12 @@ class JavaBeanBinder implements BeanBinder { @@ -192,12 +192,12 @@ class JavaBeanBinder implements BeanBinder {
});
}
private boolean isOfDifferentType(ResolvableType targetType) {
private boolean isOfDifferentType(ResolvableType targetType,
Class<?> resolvedType) {
if (this.type.hasGenerics() || targetType.hasGenerics()) {
return !this.type.equals(targetType);
}
return this.resolvedType == null
|| !this.resolvedType.equals(targetType.resolve());
return this.resolvedType == null || !this.resolvedType.equals(resolvedType);
}
@SuppressWarnings("unchecked")
@ -214,7 +214,7 @@ class JavaBeanBinder implements BeanBinder { @@ -214,7 +214,7 @@ class JavaBeanBinder implements BeanBinder {
return null;
}
Bean<?> bean = Bean.cached;
if (bean == null || bean.isOfDifferentType(type)) {
if (bean == null || bean.isOfDifferentType(type, resolvedType)) {
bean = new Bean<>(type, resolvedType);
cached = bean;
}

Loading…
Cancel
Save