Click
  1. Click
  2. CLK-667

Spring servlet should support stateful pages with transient beans

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.2.0
    • Component/s: extras
    • Labels:
      None

      Description

      SpringClickServlet currently injects beans only for newly created page instances. This works well for stateless pages but not for stateful pages that have been serialized/deserialized. After a stateful pages has been deserialized, the bean references are null.

      ClickServlet provides the #activePage hook which can be used to re-inject beans after deserialization.

      Unfortunately this fix will only apply to "Click created pages with bean injection" or option 3 described in the SpringClickServlet. Option 1 and 2, where Spring itself creates the Click pages and inject beans, does not work after deserialization because Spring does not re-initialize the page. Its possible to inject serializable proxies instead of direct references, however that could mean relying in byte code generation.

        Activity

        Hide
        Adrian A. added a comment -

        closing issue fixed a long time ago

        Show
        Adrian A. added a comment - closing issue fixed a long time ago
        Hide
        Andrew Fink added a comment -

        Also SpringClickServlet can get all fields and methods of Page annotated with @Autowired and inject them.
        It looks not so hard to implement, but covers (IMHO) 80% of functionality.

        Show
        Andrew Fink added a comment - Also SpringClickServlet can get all fields and methods of Page annotated with @Autowired and inject them. It looks not so hard to implement, but covers (IMHO) 80% of functionality.
        Hide
        Andrew Fink added a comment -
        Show
        Andrew Fink added a comment - Interesting reading about this: http://www.gridshore.nl/2009/01/27/injecting-domain-objects-with-spring/ http://static.springsource.org/spring/docs/2.5.x/reference/aop.html#aop-atconfigurable May be add these links to SpringClickServlet javadoc?
        Hide
        Bob Schellink added a comment -

        fix checked in

        Show
        Bob Schellink added a comment - fix checked in

          People

          • Assignee:
            Bob Schellink
            Reporter:
            Bob Schellink
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development