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

Cannot use Kotlin with Spring Integration 5.0.4 while Java still working (Integration Flows DSL)

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 5.0.4
    • Fix Version/s: 5.1 M1, 5.0.5
    • Component/s: DSL
    • Labels:

      Description

      kotlin 1.2.40
      spring integration 5.0.4

      (was working with 1.2.30 + 4.* spring integration)

      try to create integration flow config (several ways):

       ...
       .route
      { m : MyClass -> m.key }
      
       ...
       .route ( MyClass::class.java,
      { m : MyClass -> m.key }
      )
       ...
       //even
       .route<MyClass,String>( object:java.lang.functions.Function<MyClass,String> ...)
      

      All those notations compiled but fail at run time while Spring Integration
      cannot find method to use as Route.

      If config is rewritten in Java - all working.

      One thing is that Kotlins lambdas are not of synthetic class while Java's are,
      so Spring Integration not sees them as lambdas.

      At another hand it worked before and some DSL things as `transform` and some other still work with Kotlin lambdas.

      It can be avoided with explicit method name :

       .route (
      { m : MyClass -> m.key }
      ,"apply")
      

      While it's very ugly.

      Does anyone knew solution except "apply" or shifting @Configuration with Sp Int to Java?

        Attachments

          Activity

            People

            Assignee:
            abilan Artem Bilan
            Reporter:
            comdiv FAGIM SADYKOV
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: