Hello Every Body:
I had a problem that make I feel impossible to solve with lookup-method:
I define two class witch have same method name "sayHello":
Then, in my spring-config.xml I defined:Code:public class ClassA { public String sayHello(){ return "Hello: class A"; } public class ClassB { public String sayHello(){ return "Hello: class B"; } } }
Code:<bean id="a" class="ClassA"> </bean> <bean id="b" class="ClassB"> <lookup-method name="sayHello" bean="a"/> </bean>
When I did my test:
that throws a Exception:Code:ApplicationContext context = new ClassPathXmlApplicationContext("spring/test.xml"); ClassB b = (ClassB)context.getBean("b"); System.out.println(b.sayHello());
I donīt know why? I am using cglib-2.1.2.jar... thatīs a possible problem?Code:java.lang.ClassCastException at ClassB$$EnhancerByCGLIB$$9bd3da22.sayHello(<generated>) at TestSpring.testMethodLookup(TestSpring.java:10)![]()


Reply With Quote