-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Jim Moore opened INT-568 and commented
The following test case fails with "BeanCurrentlyInCreationException: Error creating bean with name 'org.springframework.integration.config.ConsumerEndpointFactoryBean#0': Requested bean is currently in creation: Is there an unresolvable circular reference?"
Using property or field @Autowired
injection works. Injecting in XML the value into the constructor works. Removing the splitter makes it work.
import java.util.List;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class ConstructorDITest {
@Test
public void testCreatingApplicationCtx() throws Exception {
new ClassPathXmlApplicationContext("ContructorDITest-context.xml", ConstructorDITest.class);
Thread.sleep(3000);
}
public static class MyService {
public String getVal() {
return "fooble";
}
}
public static class MyEndpoint {
private MyService myService;
@Autowired public MyEndpoint(MyService myService) {
this.myService = myService;
}
public String aProducer() {
return myService.getVal();
}
public void aConsumer(String str) {
// ignore;
}
public List<String> aSplitter(List<String> strs) {
return strs;
}
}
}
<b:beans xmlns="http://www.springframework.org/schema/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:b="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:annotation-config />
<channel id="input" />
<channel id="output" />
<b:bean id="service" class="com.mooregreatsoftware.ConstructorDITest$MyService" />
<b:bean id="endpoint" class="com.mooregreatsoftware.ConstructorDITest$MyEndpoint" />
<inbound-channel-adapter ref="endpoint" method="aProducer" channel="input">
<poller max-messages-per-poll="1">
<interval-trigger interval="300" time-unit="SECONDS" />
</poller>
</inbound-channel-adapter>
<splitter input-channel="input" output-channel="output" ref="endpoint" method="aSplitter" />
<service-activator input-channel="output" ref="endpoint" method="aConsumer"/>
</b:beans>
Affects: 1.0.1