wicket-ioc/cglib constructor injection

2008-10-20 Thread Jan Kriesten

Hi,

wicket-ioc/cglib (using 1.3-snapshot) has problems when it comes to creating
proxies for constructor injection (and also when it comes to enhance final 
classes):

Caused by: java.lang.IllegalArgumentException: Superclass has no null
constructors but no arguments were given
at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:721)
at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:499)
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:173)
at
org.apache.wicket.guice.GuiceComponentInjector.inject(GuiceComponentInjector.java:114)


Is there a way around this or could the above cases just handled to not be
enhanced at all?

Best regards, --- Jan.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: wicket-ioc/cglib constructor injection

2008-10-20 Thread Igor Vaynberg
add a package private default constructor to your class.

these are all well known limitations of proxying classes, you should try to
make sure your injected dependencies are interfaces or you something like
salve so no proxies are needed.

-igor

On Sun, Oct 19, 2008 at 11:53 PM, Jan Kriesten [EMAIL PROTECTED]wrote:


 Hi,

 wicket-ioc/cglib (using 1.3-snapshot) has problems when it comes to
 creating
 proxies for constructor injection (and also when it comes to enhance final
 classes):

 Caused by: java.lang.IllegalArgumentException: Superclass has no null
 constructors but no arguments were given
at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:721)
at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:499)
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:173)
at

 org.apache.wicket.guice.GuiceComponentInjector.inject(GuiceComponentInjector.java:114)


 Is there a way around this or could the above cases just handled to not be
 enhanced at all?

 Best regards, --- Jan.

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: wicket-ioc/cglib constructor injection

2008-10-20 Thread Jan Kriesten

Hi Igor,

 add a package private default constructor to your class.

default constructor wont work in this case.

 these are all well known limitations of proxying classes, you should try to
 make sure your injected dependencies are interfaces or you something like
 salve so no proxies are needed.

Defining an interface for the class results in wicket-ioc not injecting the
original class/constructor at all. So there's a flaw with this approach.

Best regards, --- Jan.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]