Trouble with object injection in Spring.Net

Posted by Abdel Olakara on Stack Overflow See other posts from Stack Overflow or by Abdel Olakara
Published on 2010-05-17T15:47:38Z Indexed on 2010/05/17 15:50 UTC
Read the original article Hit count: 320

Hi all,

I have a issue with my Spring.Net configuration where its not injecting an object. I have a CommService to which an object named GeneralEmail is injected to. 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="[email protected]"/>
<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 again injected to many other aspx pages & service. In one scenario, I need to call the commnucation service from an static WebMethod. I try doing:

CommService cso = new CommService();

But when i try to get the emailService object, its null! why didn't the spring inject the GeneralMail object into my cso object? What am I doing wrong and how do I access the object from spring container.

Thanks in advance for the suggestions and solutions.
Reagrds,
Abdel Olakara

© Stack Overflow or respective owner

Related posts about spring.net

Related posts about ioc