Closed
Description
Anton Filatov opened SPR-16557 and commented
Before bugfix #20744 it was impossible to use @JmsListener
annotation with cglib-proxied classes at all.
Now it works fine, but stil we need to extract annotated method into interface because processJmsListener try to search invocableMethod as follows
Method invocableMethod = AopUtils.selectInvocableMethod(mostSpecificMethod, bean.getClass());
and this lead to
...
Caused by: java.lang.IllegalStateException: Need to invoke method 'process' declared on target class 'Example', but not found in any interface(s) of the exposed proxy type. Either pull the method up to an interface or switch to CGLIB proxies by enforcing proxy-target-class mode in your configuration.
at org.springframework.core.MethodIntrospector.selectInvocableMethod(MethodIntrospector.java:135)
at org.springframework.aop.support.AopUtils.selectInvocableMethod(AopUtils.java:130)
at org.springframework.jms.annotation.JmsListenerAnnotationBeanPostProcessor.processJmsListener(JmsListenerAnnotationBeanPostProcessor.java:262)
at org.springframework.jms.annotation.JmsListenerAnnotationBeanPostProcessor.postProcessAfterInitialization(JmsListenerAnnotationBeanPostProcessor.java:240)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:423)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1633)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
... 56 common frames omitted
Message is discouraging :)
I suppose that
Method invocableMethod = AopUtils.selectInvocableMethod(mostSpecificMethod, AopUtils.getTargetClass(bean));
will fix this problem.
Affects: 4.3.14
Issue Links:
- Combining @Retryable and @Scheduled/@JmsListener doesn't work [SPR-16196] #20744 Combining
@Retryable
and@Scheduled
/@JmsListener
doesn't work