1
votes

I couldn't import java dsl config into XML configuration.

@Configuration
@EnableIntegration
@IntegrationComponentScan
public class JavaApplicationContext {

  @MessagingGateway
  public interface helloService {
    @Gateway(requestChannel = "requestChnl")
    public String sayHello(String msg);
  }

  @Bean
  public IntegrationFlow helloIntFlow() {
    return IntegrationFlows.from("requestChnl")
                           .transform(new GenericTransformer<String, String>() {

                            @Override
                            public String transform(String source) {
                              // TODO Auto-generated method stub
                              return "Hello "+source;
                            }})
                           .get();
  }


}

Inside XML config, i have <bean id="hellGtwy" class="com.example.JavaApplicationContext" />

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'helloIntFlow' defined in com.example.JavaApplicationContext: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframe work.integration.config.SplitterFactoryBean#6': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: An AbstractReplyPr oducingMessageHandler may only be referenced once (MY_SPLITTER_ID) - use scope="prototype"

I couldnt relate the exception with my code. I have no splitter in the java dsl config.

1

1 Answers

0
votes

Actually an advice from Spring team to inject XML config into Java & annotation configuration via @ImportResource.

From other side MY_SPLITTER_ID isn't related to Spring Integration Java DSL, too. The can be even with XML config.

Try to play with <component-scan> instead of raw <bean>, if you'd like to have an annotation configuration together with XML one.