Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-15887

WebFlux @MVC Controllers do not support @SessionAttributes. (plus SessionStatus)

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 5.0 RC3
    • Fix Version/s: 5.0 RC4
    • Component/s: Reactive, Web
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      @SessionAttributes is not supported by webflux.

      I am expecting same @MVC code work in both servlet or netty environment.

      A very simple example (spring-boot, kotlin, thymeleaf):

      DemoController.kt

      @Controller
      @SessionAttributes("a")
      class DemoController {
       
          @GetMapping
          fun index(model: Model): String {
              val old_a = model.asMap()["a"] as? Int
              val a = 1 + (old_a ?: 0)
       
              model["a"] = a
       
              return "index"
          }
      }
      

      index.html

      <!DOCTYPE html>
      <html>
       
      <body th:text="${a}">
      </body>
       
      </html>
      

      This demo works as expected - increasing numbers displayed for each request in web brower - with webmvc,
      but not working - the number is always 1 - with webflux.

      There's no SessionStatus argument resolver in webflux too.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            rstoya05-aop Rossen Stoyanchev
            Reporter:
            jean.ho Jean
            Last updater:
            St├ęphane Nicoll
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              4 weeks, 3 days ago