You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Kenny MacLeod (JIRA)" <ji...@apache.org> on 2009/11/11 11:46:40 UTC

[jira] Created: (WICKET-2573) Allow applications to chose not to use CGLIB proxies for @SpringBean injections

Allow applications to chose not to use CGLIB proxies for @SpringBean injections
-------------------------------------------------------------------------------

                 Key: WICKET-2573
                 URL: https://issues.apache.org/jira/browse/WICKET-2573
             Project: Wicket
          Issue Type: Improvement
          Components: wicket-spring
    Affects Versions: 1.4.3, 1.5-M1
            Reporter: Kenny MacLeod
            Priority: Minor


Spring beans fetched from the spring context and injected into wicket components are currently proxied using CGLIB before being injected. These proxies are serializable, as required by the Servlet specification.

However, this proxying puts restrictions on the beans being injected. If CGLIB cannot create the proxy (e.g. if the class to proxy has no default constructor, although there are other scenarios), then this technique does not work. Given that Spring beans can take on many obscure forms (Spring is less restrictive than CGLIB), this means that not all Spring beans can be injected.

The simplest solution to this problem is to allow applications to specify that the injected Spring beans should not be proxied. Clearly, this should not be the default behaviour, since there's no guarantee that Spring beans are properly serializable. However, in many cases the developer knows this not to be an issue, either because they know the Spring beans are serializable (and will not drag half the appcontext along with them in the process), or because they know their container does not serialize sessions. In these situations, non-serializable objects are acceptable.

It is trivial to modify SpringComponentInjector to support this behaviour. See attached patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-2573) Allow applications to chose not to use CGLIB proxies for @SpringBean injections

Posted by "Kenny MacLeod (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2573?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kenny MacLeod updated WICKET-2573:
----------------------------------

    Attachment: patch.txt
                SpringComponentInjector.java
                AnnotProxyFieldValueFactory.java

See attached patch and modified files. SpringComponentInjector has been given an additional constructor indicating the desired proxy behaviour.

> Allow applications to chose not to use CGLIB proxies for @SpringBean injections
> -------------------------------------------------------------------------------
>
>                 Key: WICKET-2573
>                 URL: https://issues.apache.org/jira/browse/WICKET-2573
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-spring
>    Affects Versions: 1.4.3, 1.5-M1
>            Reporter: Kenny MacLeod
>            Priority: Minor
>         Attachments: AnnotProxyFieldValueFactory.java, patch.txt, SpringComponentInjector.java
>
>
> Spring beans fetched from the spring context and injected into wicket components are currently proxied using CGLIB before being injected. These proxies are serializable, as required by the Servlet specification.
> However, this proxying puts restrictions on the beans being injected. If CGLIB cannot create the proxy (e.g. if the class to proxy has no default constructor, although there are other scenarios), then this technique does not work. Given that Spring beans can take on many obscure forms (Spring is less restrictive than CGLIB), this means that not all Spring beans can be injected.
> The simplest solution to this problem is to allow applications to specify that the injected Spring beans should not be proxied. Clearly, this should not be the default behaviour, since there's no guarantee that Spring beans are properly serializable. However, in many cases the developer knows this not to be an issue, either because they know the Spring beans are serializable (and will not drag half the appcontext along with them in the process), or because they know their container does not serialize sessions. In these situations, non-serializable objects are acceptable.
> It is trivial to modify SpringComponentInjector to support this behaviour. See attached patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2573) Allow applications to chose not to use CGLIB proxies for @SpringBean injections

Posted by "Philippe Laflamme (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12793726#action_12793726 ] 

Philippe Laflamme commented on WICKET-2573:
-------------------------------------------

Not a big issue, but the change breaks the Wicket API which is usually not expected with a micro release (1.4.3 vs. 1.4.4)

One of the SpringComponentInjector constructor disappeared instead of being rewritten against the API additions.

We were using this ctor which disappeared:

SpringComponentInjector(WepApplication, ApplicationContext);

> Allow applications to chose not to use CGLIB proxies for @SpringBean injections
> -------------------------------------------------------------------------------
>
>                 Key: WICKET-2573
>                 URL: https://issues.apache.org/jira/browse/WICKET-2573
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-spring
>    Affects Versions: 1.4.3, 1.5-M1
>            Reporter: Kenny MacLeod
>            Assignee: Igor Vaynberg
>            Priority: Minor
>             Fix For: 1.4.4, 1.5-M1
>
>         Attachments: AnnotProxyFieldValueFactory.java, patch.txt, SpringComponentInjector.java
>
>
> Spring beans fetched from the spring context and injected into wicket components are currently proxied using CGLIB before being injected. These proxies are serializable, as required by the Servlet specification.
> However, this proxying puts restrictions on the beans being injected. If CGLIB cannot create the proxy (e.g. if the class to proxy has no default constructor, although there are other scenarios), then this technique does not work. Given that Spring beans can take on many obscure forms (Spring is less restrictive than CGLIB), this means that not all Spring beans can be injected.
> The simplest solution to this problem is to allow applications to specify that the injected Spring beans should not be proxied. Clearly, this should not be the default behaviour, since there's no guarantee that Spring beans are properly serializable. However, in many cases the developer knows this not to be an issue, either because they know the Spring beans are serializable (and will not drag half the appcontext along with them in the process), or because they know their container does not serialize sessions. In these situations, non-serializable objects are acceptable.
> It is trivial to modify SpringComponentInjector to support this behaviour. See attached patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-2573) Allow applications to chose not to use CGLIB proxies for @SpringBean injections

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2573?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-2573.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5-M1
                   1.4.4
         Assignee: Igor Vaynberg

> Allow applications to chose not to use CGLIB proxies for @SpringBean injections
> -------------------------------------------------------------------------------
>
>                 Key: WICKET-2573
>                 URL: https://issues.apache.org/jira/browse/WICKET-2573
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-spring
>    Affects Versions: 1.4.3, 1.5-M1
>            Reporter: Kenny MacLeod
>            Assignee: Igor Vaynberg
>            Priority: Minor
>             Fix For: 1.4.4, 1.5-M1
>
>         Attachments: AnnotProxyFieldValueFactory.java, patch.txt, SpringComponentInjector.java
>
>
> Spring beans fetched from the spring context and injected into wicket components are currently proxied using CGLIB before being injected. These proxies are serializable, as required by the Servlet specification.
> However, this proxying puts restrictions on the beans being injected. If CGLIB cannot create the proxy (e.g. if the class to proxy has no default constructor, although there are other scenarios), then this technique does not work. Given that Spring beans can take on many obscure forms (Spring is less restrictive than CGLIB), this means that not all Spring beans can be injected.
> The simplest solution to this problem is to allow applications to specify that the injected Spring beans should not be proxied. Clearly, this should not be the default behaviour, since there's no guarantee that Spring beans are properly serializable. However, in many cases the developer knows this not to be an issue, either because they know the Spring beans are serializable (and will not drag half the appcontext along with them in the process), or because they know their container does not serialize sessions. In these situations, non-serializable objects are acceptable.
> It is trivial to modify SpringComponentInjector to support this behaviour. See attached patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.