2
객체를 주입하지 않는 Spring.Net 구성에 문제가 있습니다. 나는 GeneralEmail이라는 이름의 객체가 주입 된 CommService를 가지고있다.Spring.Net에서 객체 주입에 문제가 발생했습니다.
<!-- 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>
통신 서비스 개체를 다시 다른 많은 영문 페이지 & 서비스에 주입 : 여기에 구성입니다. 한 시나리오에서 정적 웹 메소드에서 commnucation 서비스를 호출해야합니다. 나는 시도 :
CommService cso = new CommService();
그러나 내가 emailService 개체를 얻으려고하면 그 null! 왜 스프링은 GeneralMail 객체를 cso 객체에 삽입하지 않았습니까? 내가 뭘 잘못하고 봄 컨테이너에서 물건에 어떻게 접근합니까?
미리 제안 해 주셔서 감사합니다.
Reagrds,
압델 Olakara