Hi Martin, thanks for your answer. I am initializing 2 A’s and put them in a List.
In the code below, I query for the index of an A in the current List ( aList.indexOf(a)). I am getting an error as the index cannot be retrieved (-1) based on the proxies. How can I retrieve the correct index (0 or 1) via the #indexOf method? Chris > Am 03.05.2015 um 21:24 schrieb Martin Grigorov <[email protected]>: > > You can wrap it in a proxy yourself: > > A a = LazyInitProxyFactory.createProxy(A.class, new IProxyTargetLocator() { > @Override public Object locateProxyTarget() {return > beanFactory.getBean("a", A.class)} > }); > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Sun, May 3, 2015 at 1:17 PM, Chris <[email protected]> wrote: > >> Hi Martin, >> >> In another panel of the same page, I have injected a service class via >> @Springbean and this service class implements „BeanFactoryAware“. >> As soon as a specific button in this panel is clicked, a method of this >> service class is called which creates A via beanFactory.getBean(„a", >> A.class). >> Via a broadcast event, a is then propagated to the panel (not page) as >> shown below. >> >> Thanks Chris >> >> >>> Am 03.05.2015 um 08:56 schrieb Martin Grigorov <[email protected]>: >>> >>> Hi, >>> >>> Please show us how A instance is being created. >>> >>> Martin Grigorov >>> Wicket Training and Consulting >>> https://twitter.com/mtgrigorov >>> >>> On Sat, May 2, 2015 at 11:32 PM, Chris <[email protected]> wrote: >>> >>>> Hi Martin, >>>> >>>> I have a page with a field of type A that is set over a broadcast event. >>>> Class A has a dao which is injected via constructor. >>>> The field dao cannot be serializable. How could I change this so a proxy >>>> is injected? >>>> >>>> Thanks! >>>> >>>> Page { >>>> >>>> A a; >>>> >>>> public void onEvent(IEvent<?> event) { >>>> super.onEvent(event); >>>> >>>> if (event.getPayload() instanceof Item) { >>>> Item update = (Item) event.getPayload(); >>>> a = update.getA(); >>>> >>>> } >>>> >>>> A implements Serializable { >>>> >>>> private Dao dao; >>>> >>>> @Autowired >>>> public A(Dao dao) { >>>> this.dao = dao; >>>> } >>>> >>>> } >>>> >>>> >>>>> Am 02.05.2015 um 21:28 schrieb Martin Grigorov <[email protected]>: >>>>> >>>>> Hi, >>>>> >>>>> Injected how? >>>>> wicket-spring and -guice inject serializable proxies so there is no >> such >>>>> issue with them >>>>> On May 2, 2015 10:26 PM, "Chris" <[email protected]> wrote: >>>>> >>>>>> Hi all, >>>>>> >>>>>> what is the best approach to handle non-serializable objects in Wicket >>>>>> pages? E.g. when an object has a DAO injected and this object is a >>>> field of >>>>>> a Wicket page? >>>>>> >>>>>> Thanks a lot, >>>>>> Chris >>>>>> --------------------------------------------------------------------- >>>>>> 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] >>>> >>>> >> >> >> --------------------------------------------------------------------- >> 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]
