Object injection problem in Spring.Net
I have a problem with my Spring.Net config where it is not injecting an object. I have a CommService to which a GeneralEmail object is injected. Here is the configuration:
<!-- GeneralMail Object -->
<object id="GeneralMailObject" type="CommUtil.Email.GeneralEmail, CommUtil">
<constructor-arg name="host" value="xxxxx.com"/>
<constructor-arg name="port" value="25"/>
<constructor-arg name="user" value="xxxx@xxxxx.com"/>
<constructor-arg name="password" value="xxxxx"/>
<constructor-arg name="template" value="xxxxx"/>
</object>
<!-- Communication Service -->
<object id="CommServiceObject" type="TApp.Code.Services.CommService, TApp">
<property name="emailService" ref="GeneralMailObject" />
</object>
The communication service object is reintroduced to many other aspx pages and service. In one scenario, I need to call the commnucation service from a static WebMethod. I am doing my best:
CommService cso = new CommService();
But when I try to get the emailService object its null! why didn't spring inject GeneralMail object into my cso object? What am I doing wrong and how do I access the object from the spring container.
Thanks in advance for suggestions and solutions. Reagrds,
Abdel Olakara
+2
a source to share