[
https://issues.apache.org/jira/browse/WICKET-3936?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andera Del Bene updated WICKET-3936:
------------------------------------
Attachment: springBeanProxy.txt
> Extend SpringBean annotation to configure proxy creation by boolean attribute
> proxy
> -----------------------------------------------------------------------------------
>
> Key: WICKET-3936
> URL: https://issues.apache.org/jira/browse/WICKET-3936
> Project: Wicket
> Issue Type: Improvement
> Components: wicket-spring
> Affects Versions: 1.4.17
> Environment: Windows, Wicket 1.4.17
> Reporter: Per Newgro
> Attachments: springBeanProxy.txt
>
>
> i would like to decouple the page dependencies. My page flow is implemented
> by using bookmarkable page links.
> As we all know they take a page class as parameter. This couples both pages.
> So i thought it's a good idea to give the page class a name in my Spring
> application context and reference it in
> the caller page.
> <code>
> public StartPage extends WebPage {
> @SpringBean(name="nextPageClass")
> private Class<? extends Page> _nextPageClass;
> public StartPage() {
> add(new BookmarkablePageLink("toNextPage", _nextPageClass);
> }
> }
> </code>
> My application context defines:
> <code>
> <bean id="nextPageClass" class="java.lang.Class" factory-method="forName">
> <constructor-arg value="my.NextPage"/>
> </bean>
> </code>
> But it's not working while java.lang.Class is final. I get
> Caused by: java.lang.IllegalArgumentException: Cannot subclass final class
> class java.lang.Class
> at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:446)
> at
> net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
> at
> net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
> at
> org.apache.wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:174)
> at
> org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:130)
> at org.apache.wicket.injection.Injector.inject(Injector.java:103)
> ... 47 more
> I worked around this by setting wrapWithProxies to false in Application.inits
> <code>
> addComponentInstantiationListener(new SpringComponentInjector(this,
> context(), false));
> </code>
> But this way i can set the behavior only globally. The consequences are that
> all my daos and services have to be serializable.
> It would be nice if SpringBean could be configured to use wrapInProxy or not
> (Martin G. suggested this). Default could be true so no
> behavior change occurs.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira