Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-4367

Definition of service-activator in pojo-style does not work with annotaded parameters


    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 5.0 GA
    • Fix Version/s: 5.0.1
    • Component/s: None
    • Labels:


      Bug affects 5.0.0.RELEASE - this version is missing in "Affected Versions" so I choose 5.0 GA
      Please add version 5.0.0.RELEASE and switch this bug.

      We use a service-activator defined in xml in pojo-style:

          <int:chain id="tradeChain" input-channel="tradeEvent">
              <int:service-activator ref="connector"  method="processTrade" />

      In the java code we use @Header and @Payload to annotate parameters:

          public void processTrade(@Header("VERSION") String version, @Payload String json) {

      This szenario worked fine with Spring Integration 4.3.1 and Spring Core 4.3.2
      After updating to Spring Integration 5.0.2 and Spring Core 5.0.0 this construct causes an error:

      [ClassPathXmlApplicationContext] Exception encountered during context initialization - 
      cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: 
      Error creating bean with name 'org.springframework.integration.handler.MessageHandlerChain#1': 
      Cannot create inner bean 'tradeChain$child#0.handler' of type
      while setting bean property 'handlers' with key [0]; 
      nested exception is org.springframework.beans.factory.BeanCreationException: 
      Error creating bean with name 'tradeChain$child#0.handler': 
      FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: 
      Target object of type [class a.b.c.Connector$$EnhancerBySpringCGLIB$$a6c4f9e9] 
      has no eligible methods for handling Messages.

      Seems like a regression "There may be some other corner cases that we haven’t considered ..." on page 24 in https://docs.spring.io/spring-integration/docs/5.0.0.RELEASE/reference/pdf/spring-integration-reference.pdf

      Using @ServiceActivator in java instead of xml pojo-style definition works fine:

      @ServiceActivator(inputChannel = "tradeEvent")


        1. AppTest.java
          1 kB
        2. Connection.xml
          1 kB
        3. Connector.java
          0.9 kB
        4. int-4367.tar
          20 kB
        5. pom.xml
          1 kB

          Issue Links



              • Assignee:
                abilan Artem Bilan
                spring@c2m.de Martin Wittmann
              • Votes:
                0 Vote for this issue
                2 Start watching this issue


                • Created: