Re: IOC problem

2007-11-18 Thread Al Maw

Uwe Schäfer wrote:

Is it currently impossible to use constructor injection ?


To quickly answer my own question: no, but little tricky! :)
Well, you need to replace instances of new FooComponent() with something 
that gets injected, like a Provider if you're using Guice, or some 
kind of bean factory if you use Spring.
I´d like to share the experience to the wiki or wherever the right 
place for 'little gotchas' is.


Is there a place where you can find wicket-guice notes already?

Not really. Feel free to add like Gwyn said.

Regards,

Al

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



Re: IOC problem

2007-11-16 Thread Uwe Schäfer

Gwyn Evans schrieb:


but I'd suggest that the
correct place would be in a page below the "Integration guides" page


thanks, will do that on Sunday.


--

THOMAS DAILY GmbH
Adlerstraße 19
79098 Freiburg
Deutschland
T  + 49 761 3 85 59 0
F  + 49 761 3 85 59 550
E  [EMAIL PROTECTED]
www.thomas-daily.de

Geschäftsführer/Managing Directors:
Wendy Thomas, Susanne Larbig
Handelsregister Freiburg i.Br., HRB 3947


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



Re: IOC problem

2007-11-16 Thread Gwyn Evans
There's nothing on the Wiki at the moment, but I'd suggest that the
correct place would be in a page below the "Integration guides" page
at http://cwiki.apache.org/WICKET/integration-guides.html.  Just go
there, then "Add page" and it should automatically appear in the
"Reference page/Integration Guides" list.

/Gwyn

On 15/11/2007, Uwe Schäfer <[EMAIL PROTECTED]> wrote:
> Uwe Schäfer schrieb:
>
> > Is it currently impossible to use constructor injection ?
>
> To quickly answer my own question: no, but little tricky! :)
> I´d like to share the experience to the wiki or wherever the right place
> for 'little gotchas' is.
>
> Is there a place where you can find wicket-guice notes already?
>
> Al?
>
> cu uwe
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Download Wicket 1.3.0-rc1 now! - http://wicketframework.org

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



Re: IOC problem

2007-11-15 Thread Uwe Schäfer

Uwe Schäfer schrieb:


Is it currently impossible to use constructor injection ?


To quickly answer my own question: no, but little tricky! :)
I´d like to share the experience to the wiki or wherever the right place 
for 'little gotchas' is.


Is there a place where you can find wicket-guice notes already?

Al?

cu uwe


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



IOC problem

2007-11-15 Thread Uwe Schäfer

Hi

I´m using Guice with Wicket and i´m quite happy with it. Now I have a 
problem with the IOC, and i think, i´d need some help there :)


I have a service-class X

public class X{
 @Inject public X(Y y)
 {
  ...
 }
}

bound like this:

bind(X.class).in(MyScopes.SOMETHING);
bind(Y.class).to(SomeYImpl.class);


I´m trying to use it in a page:

public class P extends WebPage{
 @Inject
 private X x;

 public P(){
  ...
  x.foo();
 }
}

What i see is this:

java.lang.IllegalArgumentException: Superclass has no null constructors 
but no arguments were given

 at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:718)
 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:164)
 at 
org.apache.wicket.guice.GuiceComponentInjector.inject(GuiceComponentInjector.java:112)
 at 
org.apache.wicket.guice.GuiceComponentInjector.onInstantiation(GuiceComponentInjector.java:193)
 at 
org.apache.wicket.Application.notifyComponentInstantiationListeners(Application.java:973)

 at org.apache.wicket.Component.(Component.java:865)
 at org.apache.wicket.MarkupContainer.(MarkupContainer.java:104)
 at org.apache.wicket.Page.(Page.java:230)

The obvious problem can be found in LazyInitProxyFactory:

CGLibInterceptor handler = new CGLibInterceptor(type, locator);

Enhancer e = new Enhancer();
e.setInterfaces(new Class[] { Serializable.class, ILazyInitProxy.class,
IWriteReplace.class });
e.setSuperclass(type);
e.setCallback(handler);
return e.create(); // <-- !

Is it currently impossible to use constructor injection ?

cu uwe
--

THOMAS DAILY GmbH
Adlerstraße 19
79098 Freiburg
Deutschland
T  + 49 761 3 85 59 0
F  + 49 761 3 85 59 550
E  [EMAIL PROTECTED]
www.thomas-daily.de

Geschäftsführer/Managing Directors:
Wendy Thomas, Susanne Larbig
Handelsregister Freiburg i.Br., HRB 3947


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