Announcement Announcement Module
Collapse
No announcement yet.
Spring 3.1 breaks usual return value handling scheme Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3.1 breaks usual return value handling scheme

    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!!!

  • #2
    If you can share explicit source code and indicating where It are failing would be better for us (use code tags)

    Are you receiving some error stack trace?

    Comment


    • #3
      This code works in 3.0 but doesn't in 3.1:

      Code:
          @RequestMapping("/test")
          public Object test(@RequestParam boolean flag) {
              if (flag) {
                  return "redirect:/";
              } else {
                  return new RedirectView("/");
              }
          }
      It results in the exception "Could not resolve view with name 'test'" for all values of parameter 'flag'.
      Last edited by vypedrik; Mar 11th, 2012, 07:19 AM.

      Comment


      • #4
        Some explanation has been posted in comments to SPR-9218.

        Comment

        Working...
        X