Results 1 to 4 of 4

Thread: Spring 3.1 breaks usual return value handling scheme

Hybrid View

  1. #1
    Join Date
    Mar 2012
    Posts
    3

    Angry 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. #2
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    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?
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  3. #3
    Join Date
    Mar 2012
    Posts
    3

    Default

    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 at 07:19 AM.

  4. #4
    Join Date
    Mar 2012
    Posts
    3

    Default

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •