Page 1 of 1

applicationContext - null value from getter. Please help.

Posted: 29 Oct 2013, 17:23
by jwalters
Dear All.

I am using spring 3.0 and trying to inject the beans using the setter methods. Here when i have both the property name and the reference bean name as same/ identical, it works properly. But when i change the reference name as something different from the property name, it gives returns me null object. please help. thank you very much.

with same name: (the bean gets returned successfully)
=========================================
<bean id="BMOWirBaseAction" class="com.symcor.wiradmin.web.action.WIRAdminBaseAction">
<property name="cacheDelegate">
<ref bean="cacheDelegate" />
</property>
</bean>

with different name: (null getting returned)
============================================
<bean id="BMOWirBaseAction" class="com.symcor.wiradmin.web.action.WIRAdminBaseAction">
<property name="cacheDelegate">
<ref bean="BMOCacheDelegate" />
</property>
</bean>

JAVA Code:
==========
public class WIRAdminBaseAction extends ActionSupport implements Preparable, ParameterAware, Parameterizable, SessionAware,RequestAware {

private ICacheDelegate cacheDelegate;

public ICacheDelegate getCacheDelegate() {
return cacheDelegate;
}

public void setCacheDelegate(ICacheDelegate cacheDelegate) {
this.cacheDelegate = cacheDelegate;
}
}


bye, Jonathan

Re: applicationContext - null value from getter. Please help

Posted: 29 Oct 2013, 17:31
by knorke
I believe you are looking for the java spring framework thing.
Here you are at the site of spring RTS, a game engine ;)