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

<service-activator> calls random method if none is specified

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 3.0 M3
    • Fix Version/s: 3.0 RC1
    • Component/s: Core
    • Labels:

      Description

      I have this xml config:

      <service-activator ref="handler"/>
      

      And this bean:

      public class Handler {
      
        // @ServiceActivator
        public Message<?> handleMessage(Message<?> message) {
          // do something
          return message;
        }
      
        public void setProp(String prop) { ... }
        public String getProp() { ... }
      
      }
      

      If @ServiceActivator annotation is not present, <service-activator> calls random method from Handler (Class.getMethods() is unordered).
      If @ServiceActivator annotation is present, everything works as expected.

      I took me long time to find out why is my flow behaving strangely - when debugging it always worked, but not when running without debugging.

      I understand there's power in choosing method during message processing and issuing exception during configuration is not an option, but there should be at least some warning issued during message processing if there's ambiguity in which method will be called.

        Attachments

          Activity

            People

            Assignee:
            abilan Artem Bilan
            Reporter:
            pavel.cernocky Pavel Černocký
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: