Reputation: 1600
I have a project A which uses AnnotationConfigApplicationContext to define the application context like:
private static AnnotationConfigApplicationContext getApplicationContext() {
if (applicationContext == null) {
applicationContext = new AnnotationConfigApplicationContext(AdapterContext.class);
}
return applicationContext;
}
This code works fine within project A.
Now, i added project A to the build path of project B (by choosing project properties ->java build path ->projects tab) . Now, i have a testcase in project B which uses the method
getApplicationContext()
. When i run this test case, i get the error:
java.lang.NoSuchMethodError: org.springframework.core.GenericTypeResolver.resolveTypeArguments(Ljava/lang/Class;Ljava/lang/Class;)[Ljava/lang/Class;
I tried debugging my code and found that it is working fine till the method getApplicationContext() is called.
Does anyone know what i have to do to make this work? Thanks
Upvotes: 0
Views: 2260
Reputation: 4905
A NoSuchMethodError
is almost always due to conflicting library versions. In this case I'm guessing there are multiple versions of spring libraries in the two projects. How are you building the project (i.e. are you using ant, maven, gradle, etc)?
Upvotes: 1