Spring Framework
  1. Spring Framework
  2. SPR-9218

Value-oriented return method handling broken in 3.1

    Details

      Description

      I've noticed a significant difference in processing of controller methods introduced in 3.1, what stops me from migration from 3.0.

      In 3.0, method return values were observed to determine the appropriate handler. Using this feature, it was possible to define the method as returning Object and return anything appropriate for particular case: String with view name, concrete View instance, Custom object serialized to JSON, etc.

      Starting from 3.1, not the method return value but rather the declared method return type is taken into account, thus killing such a beautiful feature. According to the handler matching chain, for the Object return value, only the fallback handler for binding return values to model attributes is triggered.

      Please get this feature back!!!

        Activity

        Hide
        Rossen Stoyanchev added a comment -

        Yes indeed decisions are now made based on the return type from the method signature rather than the actual value. We'll see what we can do to address this. In the mean time, you can continue to use the AnnotationMethodHandlerAdapter even in Spring 3.1, which should give you the exact existing behavior. See the reference docs.

        Show
        Rossen Stoyanchev added a comment - Yes indeed decisions are now made based on the return type from the method signature rather than the actual value. We'll see what we can do to address this. In the mean time, you can continue to use the AnnotationMethodHandlerAdapter even in Spring 3.1, which should give you the exact existing behavior. See the reference docs .

          People

          • Assignee:
            Rossen Stoyanchev
            Reporter:
            Jiří Vypědřík
            Last updater:
            Chris Beams
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              2 years, 5 weeks, 3 days ago