Thanks for the explanation, that makes perfect sense. ________________________________
From: lars vonk [mailto:[EMAIL PROTECTED] Sent: Thu 3/20/2008 10:16 AM To: users@wicket.apache.org Subject: Re: Suggested Enhancement To Spring Support Spring support in Wicket works with proxies, so your services are not Serialized by Wicket, but your Proxy is. With your suggestion your Service will be Serialized and with it all its dependencies like DAO's etc. This will most likely cause trouble when you are in a clustered environment and use Session replication. Also using this approach your Spring bean is no longer a singleton, but as long as your beans are stateless this does not really matter. - Lars On Thu, Mar 20, 2008 at 2:44 PM, Zappaterrini, Larry < [EMAIL PROTECTED]> wrote: > I suppose I need to learn more about how Spring support is implemented in > Wicket. My thinking was that the injected property would simply get set to > null. Then the getter for that injected property can perform a null check > and lazily initialize it with a default type if necessary: > > @SpringBean(name = "someService") > private Service service; > > public Service getService() { > if (service == null) { > service = new DefaultService(); > } > return service; > } > > This allows for default implementation to be provided that can then be > overridden by declaring the bean in Spring. I've used this type of pattern > with Spring in other settings and thought it might be useful in Wicket too. > > ________________________________ > > From: Igor Vaynberg [mailto:[EMAIL PROTECTED] > Sent: Wed 3/19/2008 5:49 PM > To: users@wicket.apache.org > Subject: Re: Suggested Enhancement To Spring Support > > > > you want to swallow the exception? > > then you would return a null into a proxy and cause an npe later... > > -igor > > > On Wed, Mar 19, 2008 at 1:43 PM, Zappaterrini, Larry > <[EMAIL PROTECTED]> wrote: > > It might be a nice improvement to Wicket's Spring support to allow for > > missing bean definitions to be handled gracefully. This would allow for > > the use of a sane default in the absence of explicit declaration in the > > context XML. Right now using the Spring annotations support I get the > > following error when I don't define the object in the XML: > > > > org.springframework.beans.factory.NoSuchBeanDefinitionException: No > bean > > named 'beanName' is defined > > at > > > org.springframework.beans.factory.support.DefaultListableBeanFactory.get > > BeanDefinition(DefaultListableBeanFactory.java:355) > > at > > > org.springframework.beans.factory.support.AbstractBeanFactory.getMergedB > > eanDefinition(AbstractBeanFactory.java:800) > > at > > > org.springframework.beans.factory.support.AbstractBeanFactory.isSingleto > > n(AbstractBeanFactory.java:343) > > at > > > org.springframework.context.support.AbstractApplicationContext.isSinglet > > on(AbstractApplicationContext.java:654) > > at > > org.apache.wicket.spring.SpringBeanLocator.isSingletonBean > (SpringBeanLoc > > ator.java:133) > > at > > > org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.get > > FieldValue(AnnotProxyFieldValueFactory.java:91) > > at org.apache.wicket.injection.Injector.inject(Injector.java:108) > > at > > org.apache.wicket.injection.ConfigurableInjector.inject > (ConfigurableInje > > ctor.java:39) > > at > > org.apache.wicket.injection.ComponentInjector.onInstantiation > (ComponentI > > njector.java:52) > > at > > org.apache.wicket.Application.notifyComponentInstantiationListeners > (Appl > > ication.java:973) > > at org.apache.wicket.Component.<init>(Component.java:866) > > > > ... truncated for brevity > > > > Using getSpringContext().contains(String) either within or as an > exposed > > method of SpringBeanLocator would probably be sufficient to avoid > > hitting this exception. > > > > Thanks, > > Larry > > > > ______________ > > > > The information contained in this message is proprietary and/or > confidential. If you are not the > > intended recipient, please: (i) delete the message and all copies; (ii) > do not disclose, > > distribute or use the message in any manner; and (iii) notify the > sender immediately. In addition, > > please be aware that any message addressed to our domain is subject to > archiving and review by > > persons other than the intended recipient. Thank you. > > _____________ > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > ______________ > > The information contained in this message is proprietary and/or > confidential. If you are not the > intended recipient, please: (i) delete the message and all copies; (ii) do > not disclose, > distribute or use the message in any manner; and (iii) notify the sender > immediately. In addition, > please be aware that any message addressed to our domain is subject to > archiving and review by > persons other than the intended recipient. Thank you. > _____________ > ______________ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you. _____________
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]