Browse Source

Use BeanUtils to instantiate target type

Use BeanUtils.instantiate(Class<?>) instead of a raw call to
type.newInstance() as the former has more checks.

Issue: SPR-12520
pull/799/head
Stephane Nicoll 11 years ago
parent
commit
c0269770af
  1. 2
      spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java

2
spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java

@ -648,7 +648,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra @@ -648,7 +648,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
return CollectionFactory.createMap(type, (keyDesc != null ? keyDesc.getType() : null), 16);
}
else {
return type.newInstance();
return BeanUtils.instantiate(type);
}
}
catch (Exception ex) {

Loading…
Cancel
Save