I seem to have a problem.
I have a class
@Component @Scope("prototype") public class MyClass extends BaseClass { .... ... @Async public void doSomething() { .... } .... }
and spring config containing
<context:annotation-config /> <context:component-scan base-package="com.company.project" /> <task:annotation-driven executor="taskExecutor"/> <task:executor id="taskExecutor" pool-size="10" queue-capacity="10" />
and in some part of the code I have
BaseClass bean = springBeans.getBean(MyClass.class);
but i get this exception
org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'myClass' must be of type [com.company.project.MyClass], but was actually of type [$Proxy19] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:361)
I can understand its proxy class, but not sure why Spring doesn't allow proxy conversion.
I have cglib 2.2 no dep in the class path, as well as Spring 3.2 core libs.
can anyone point out any clues regarding fixing this?
In short, I want the method to be Async when called.
source share