Skip to content

Commit 6bfead2

Browse files
committed
Further compensation for STS version mismatch
Current STS version of Spring (3.0.5) does not contain the BeanUtils.instantiateClass(Class<?>, Class<T>) signature that was added in 3.1.0, therefore NoSuchMethodErrors are being thrown when STS classloads and delegates to 3.1.0 NamespaceHandler and BeanDefinitionParser implementations on the user project classpath. In this case, it's AbstractSpecificationBeanDefinitionParser doing the calling to the unknown new method. In this specific example, reverting back to the old single-arg signature is actually not a problem, because it does accept Class<T> and returns an instance of type T, which was the desired behavior in the first place. The newer signature remains in order to accommodate callers who do not know the generic type of the Class to be instantiated (i.e. Class<?>), but do know the type that it should be assignable to -- this becomes the second argument Class<T>, and an instance of type T is returned (if indeed it is assignable to the specified type; otherwise IllegalArgumentException.
1 parent d7a8536 commit 6bfead2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

org.springframework.context/src/main/java/org/springframework/context/config/AbstractFeatureSpecification.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public String sourceName() {
7171

7272
public void execute(SpecificationContext specificationContext) {
7373
FeatureSpecificationExecutor executor =
74-
BeanUtils.instantiateClass(this.executorType, FeatureSpecificationExecutor.class);
74+
BeanUtils.instantiateClass(this.executorType);
7575
executor.execute(this, specificationContext);
7676
}
7777

0 commit comments

Comments
 (0)