if the "org.apache" is missing, you're using an old version of wicket. check
your dependencies for 1.2 versions (the version before wicket moved to
apache)

for the DI stuff: I'm using the annotation approach throughout my
applications and never had any problems

regards,
Michael


christian.helmbold wrote:
> 
> Thanks for your answer.
> 
> 
>> > Wouldn't it be sufficient to use a static member to hold a reference to
>> a 
>> service? i.e.
>> > 
>> > public class SomeWicketComponent{
>> >   private static MyService service;
>> >   // ...
>> > }
>> > 
>> 
>> How would you intialize these? Would you have a static getter, and force
>> yourself to remember to always use it? Or would you have a static setter
>> and centralize the initialization code somewhere else? Either way sounds
>> ugly to me.
> 
> This is the DI problem, but in this step I only regarded the serialization
> problem. I wanted to fetch object as you described it:
> 
>>   MyService svc = (MyService) MyApp.getBean("myService");
>> 
>> Let's see, where to start...
>> 
>> - it's ugly
>> - the cast and the bean name can fail in a way that is only detectable
>>   at runtime
>> - it ties all your components to your application class
>> - it's difficult to test, since you need to mock up a MyApp instance for
>>   your component to work
> 
> You're right. My solution is like a solution without DI and with all the
> dependency troubles DI should avoid.
> 
>> What don't you like about them? 
> 
> Annotations are often missused and they bring a declarative programming
> style to Java. Sometimes you don't know what happens in the background. A
> programm can better be understood if you can follow the instruction
> instead of guessing how annotions will be interpreted. I think of Spring
> MVC where a @Controller exists. It indicates that you want the class to be
> a controller. But you don't see how the controller must look like, you
> don't see that you need other annotations to get your controller working.
> The old style with extendig some framework classes are much more readable
> but a bit more verbose.
> 
> But there are also some good use cases for annotations like JPA and maybe
> the mentonioned annotation to integrate Spring in Wicket.
> 
> I tried to use Spring integration but failed. I wonder about the class
> org.apache.wicket.spring.injection.annot.SpringComponentInjector mentioned
> in the API doc. This class does not exist! I've only found
> wicket.spring.injection.annot.SpringComponentInjector. The missing
> "org.apache" should be irrelevant, but the following example doesn't work:
> 
> package some.package;
> 
> import org.apache.wicket.Page;
> import org.apache.wicket.protocol.http.WebApplication;
> import wicket.spring.injection.annot.SpringComponentInjector;
> 
> public class WickiApplication extends WebApplication
> {
> 
>   @Override
>   public void init()
>   {
>     addComponentInstantiationListener(new SpringComponentInjector(this));
>   }
> 
>   // ...
> 
> }
> 
> The compiler says: "cannot find symbol. symbold: constructor
> SpringComponentInjector(...)"
> 
> SpringComponentInjector is on the classpath, the import is correct, but it
> doesn't work. Have you any idea why?
> 
> Thanks.
> 
> Christian
> 
> -- 
> http://www.groovy-forum.de
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 


-----
Michael Sparer
http://techblog.molindo.at
-- 
View this message in context: 
http://www.nabble.com/Avoid-serialization-troubles-with-static-members-tp22082899p22097988.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to