You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Matthijs Wensveen (JIRA)" <ji...@apache.org> on 2007/05/30 12:38:15 UTC

[jira] Created: (WICKET-603) Injecting a reference to a bean which is of a final class fails

Injecting a reference to a bean which is of a final class fails
---------------------------------------------------------------

                 Key: WICKET-603
                 URL: https://issues.apache.org/jira/browse/WICKET-603
             Project: Wicket
          Issue Type: Bug
          Components: wicket-spring
    Affects Versions: 1.2.6
            Reporter: Matthijs Wensveen


When using the @SpringBean annotation, injecting a bean that is of a final class such as String, fails. This is because LazyInitProxyFactory tries to create a subclass of the bean which will obviously fail when that class is marked final.

A possible fix would be to test the modifiers of the injected field for Modifier.isFinal(..), when this is true don't create a proxy but return the object directly.

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


[jira] Commented: (WICKET-603) Injecting a reference to a bean which is of a final class fails

Posted by "Matthijs Wensveen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509510 ] 

Matthijs Wensveen commented on WICKET-603:
------------------------------------------

Thanks for fixing this. I sometimes use spring to inject configuration values too, which might be mis-use of spring, but works quite well.

Special-casing String is fine by me, as that is the only case I ever use :)

> Injecting a reference to a bean which is of a final class fails
> ---------------------------------------------------------------
>
>                 Key: WICKET-603
>                 URL: https://issues.apache.org/jira/browse/WICKET-603
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-spring
>    Affects Versions: 1.2.6
>            Reporter: Matthijs Wensveen
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-beta2
>
>
> When using the @SpringBean annotation, injecting a bean that is of a final class such as String, fails. This is because LazyInitProxyFactory tries to create a subclass of the bean which will obviously fail when that class is marked final.
> A possible fix would be to test the modifiers of the injected field for Modifier.isFinal(..), when this is true don't create a proxy but return the object directly.

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


[jira] Updated: (WICKET-603) Injecting a reference to a bean which is of a final class fails

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

Alastair Maw updated WICKET-603:
--------------------------------


If they're not careful, people can obviously make a final class that is ApplicationContextAware, and we'll end up serializing the entire context, which is bad.

The use of Strings as Beans is very odd - taking dependency injection a bit too far, IMHO. If you have a good use case, I guess we could special-case String. You could always have a factory bean which returned the String, though. I think that would be proxyable.

> Injecting a reference to a bean which is of a final class fails
> ---------------------------------------------------------------
>
>                 Key: WICKET-603
>                 URL: https://issues.apache.org/jira/browse/WICKET-603
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-spring
>    Affects Versions: 1.2.6
>            Reporter: Matthijs Wensveen
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-beta3
>
>
> When using the @SpringBean annotation, injecting a bean that is of a final class such as String, fails. This is because LazyInitProxyFactory tries to create a subclass of the bean which will obviously fail when that class is marked final.
> A possible fix would be to test the modifiers of the injected field for Modifier.isFinal(..), when this is true don't create a proxy but return the object directly.

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


[jira] Updated: (WICKET-603) Injecting a reference to a bean which is of a final class fails

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

Alastair Maw updated WICKET-603:
--------------------------------

    Fix Version/s: 1.3.0-beta3
         Assignee: Alastair Maw

> Injecting a reference to a bean which is of a final class fails
> ---------------------------------------------------------------
>
>                 Key: WICKET-603
>                 URL: https://issues.apache.org/jira/browse/WICKET-603
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-spring
>    Affects Versions: 1.2.6
>            Reporter: Matthijs Wensveen
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-beta3
>
>
> When using the @SpringBean annotation, injecting a bean that is of a final class such as String, fails. This is because LazyInitProxyFactory tries to create a subclass of the bean which will obviously fail when that class is marked final.
> A possible fix would be to test the modifiers of the injected field for Modifier.isFinal(..), when this is true don't create a proxy but return the object directly.

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


[jira] Updated: (WICKET-603) Injecting a reference to a bean which is of a final class fails

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

Alastair Maw updated WICKET-603:
--------------------------------

    Fix Version/s:     (was: 1.3.0-beta3)
                   1.3.0-beta2

> Injecting a reference to a bean which is of a final class fails
> ---------------------------------------------------------------
>
>                 Key: WICKET-603
>                 URL: https://issues.apache.org/jira/browse/WICKET-603
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-spring
>    Affects Versions: 1.2.6
>            Reporter: Matthijs Wensveen
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-beta2
>
>
> When using the @SpringBean annotation, injecting a bean that is of a final class such as String, fails. This is because LazyInitProxyFactory tries to create a subclass of the bean which will obviously fail when that class is marked final.
> A possible fix would be to test the modifiers of the injected field for Modifier.isFinal(..), when this is true don't create a proxy but return the object directly.

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


[jira] Resolved: (WICKET-603) Injecting a reference to a bean which is of a final class fails

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

Alastair Maw resolved WICKET-603.
---------------------------------

    Resolution: Fixed

Fixed for Strings only in r546147.

> Injecting a reference to a bean which is of a final class fails
> ---------------------------------------------------------------
>
>                 Key: WICKET-603
>                 URL: https://issues.apache.org/jira/browse/WICKET-603
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-spring
>    Affects Versions: 1.2.6
>            Reporter: Matthijs Wensveen
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-beta3
>
>
> When using the @SpringBean annotation, injecting a bean that is of a final class such as String, fails. This is because LazyInitProxyFactory tries to create a subclass of the bean which will obviously fail when that class is marked final.
> A possible fix would be to test the modifiers of the injected field for Modifier.isFinal(..), when this is true don't create a proxy but return the object directly.

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