I am developing a web application supported by Spring Integration. I am using 1.0.4.RELEASE. I am using CGLib proxy. I have a transactional message endpoint. Everything worked correctly, but I experimented a bit with annotations. I am using annotation-config, which works fine. I started by switching my service activator configuration from xml to annotations, but that failed.
The following configuration worked correctly:
spring -integration.xml
<channel id="inChannel" /> <channel id="outChannel" /> <service-activator method="myMethod" input-channel="inChannel" ref="myService" output-channel="outChannel" />
MyService.java
@MessageEndpoint @Transactional public class MyService { @Autowired private MyDao myDao; public MyObject myMethod(String message) throws Exception { ... } }
Trying to achieve exactly the same functionality using annotations (bearing in mind that I use CGLIB, so I don't need an interface, but a default constructor) I
- remote service activator from my .xml
- changed MyService:
Modified by MyService.java
@MessageEndpoint @Transactional public class MyService { @Autowired private MyDao myDao; public MyService () { } @ServiceActivator(inputChannel="inChannel", outputChannel="outChannel") public MyObject myMethod(String message) throws Exception { ... } }
I get the following error: java.lang.IllegalArgumentException: Superclass has no null constructors, but no arguments were given
I saw a lot of threads describing the following error article , but the problem was in custom classes. My problem is with the Spring class.
Error creating bean with name 'myService' nested exception is org.springframework.aop.framework.AopConfigException Could not generate CGLIB subclass of class [class org.springframework.integration.handler.ServiceActivatingHandler] java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
What happened? Why is Spring trying to create a proxy for the Spring class, but not just for MyService? Is my class wrapped up somehow? I do not understand what is going on. Help with thanks.