Skip to content

Commit

Permalink
Further compensation for STS version mismatch
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cbeams committed Feb 10, 2011
1 parent d7a8536 commit 6bfead2
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public String sourceName() {

public void execute(SpecificationContext specificationContext) {
FeatureSpecificationExecutor executor =
BeanUtils.instantiateClass(this.executorType, FeatureSpecificationExecutor.class);
BeanUtils.instantiateClass(this.executorType);
executor.execute(this, specificationContext);
}

Expand Down

0 comments on commit 6bfead2

Please sign in to comment.