You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2013/02/26 16:18:14 UTC

[jira] [Comment Edited] (WICKET-5052) @SpringBean fails to inject composite interfaces

    [ https://issues.apache.org/jira/browse/WICKET-5052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13587188#comment-13587188 ] 

Martin Grigorov edited comment on WICKET-5052 at 2/26/13 3:17 PM:
------------------------------------------------------------------

The problem is related to the visibility of the interfaces. All of them have package visibility.
Make com.mycompany.service1.TestService1Sub1, com.mycompany.service1.TestService1Sub2 and com.mycompany.service1.TestService1 public and the test passes.
No need to make the impls visible.

Wicket creates serializable proxy around the Spring bean. So it needs to be able to see the methods in the interfaces. The test passes if you use just pure Spring code only because the test class is in the same package as the service interfaces and impls. But since the proxy is in org.apache.wicket.ioc package it cannot see the methods.
                
      was (Author: mgrigorov):
    The problem is related to the visibility of the interfaces. All of them have package visibility.
Make com.mycompany.service1.TestService1Sub1, com.mycompany.service1.TestService1Sub2 and com.mycompany.service1.TestService1 and the test passes.
No need to make the impls visible.

Wicket creates serializable proxy around the Spring bean. So it needs to be able to see the methods in the interfaces. The test passes if you use just pure Spring code only because the test class is in the same package as the service interfaces and impls. But since the proxy is in org.apache.wicket.ioc package it cannot see the methods.
                  
> @SpringBean fails to inject composite interfaces
> ------------------------------------------------
>
>                 Key: WICKET-5052
>                 URL: https://issues.apache.org/jira/browse/WICKET-5052
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-spring
>    Affects Versions: 6.6.0, 1.5.10
>         Environment: Tomcat 6.0.35
> Java 1.6.0.37
>            Reporter: Antoine Dupuis
>         Attachments: springbean-tests.tgz
>
>
> @SpringBean fails to inject properly classes with a composite interface.
> eg :
> interface Something1 {}
> interface Something2 {}
> interface Something extends Something1, Something2 {}
> class TestBean implements Something {}
> public class TestPage extends WebPage {
> @SpringBrean
> private Something something;
> }
> Trying to inject a bean implementing the Something interface does not seems to fail at first, but when calling any method an IllegalAccessException is thrown, similar to this :
> java.lang.IllegalAccessException: Class org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler can not access a member of class {replaced} with modifiers "public abstract"
> I've attached different test cases reproducing the problem.
> As a side note, referencing directly the implementing class like this seems to work : 
> public class TestPage extends WebPage {
> @SpringBrean
> private TestBean something;
> }
> But it kind of defeats the purpose of DI.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira