Hi,

Wicket uses CGLib proxies, to proxy beans which are not referenced by their interface.
This leads to the constructor being fired once for each injection.

If you don't want this, declare the type of the @SpringBean member as an interface.

Sven



On 02/11/2014 08:46 PM, Entropy wrote:
I think this is a problem in spring and wicket working together.  This is in
1.4.7.

In spring:
        <bean id="portalResources"
class="gov.usdoj.afms.afmsportal.application.AFMSPortalResources"
init-method="init" scope="singleton">
                <property name="portalService" ref="portalService"/>
                <property name="env" value="${environment}" />
                <property name="version" value="${version}" />
                <property name="localDev" value="${localdev}" />
                <property name="production" value="${production}" />
                <property name="localDevUserName" value="${localdev_username}" 
/>
        </bean>

This bean is injected into a wicket page with @SpringBean.  Using
breakpoints I can see spring insantiating this bean, and setting the
properties.  The values are there.  This happens on application startup.

But when I got to get the injected bean, the constructor fires again, but
the init method and the setting or properties are NOT called, and despite
the scope=singleton, a second completley different instance is being
instantiated and injected.  And it's empty, which is no good.

Any ideas on this?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/SpringBean-and-properties-file-tp4664377.html
Sent from the Users forum 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



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

Reply via email to