2012-07-13 4 views
0

Spring Framework .NET에서 주입하고자하는 속성을 가진 웹 서비스가 있습니다. 오류 메시지가없고 아직 주입이 없습니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까? 여기 웹 서비스에서 Spring Framwork .NET을 사용하여 속성을 주입하는 방법은 무엇입니까?

내가 XML 파일이 무엇 :

여기
<object type="MyCompany.MyProject.Business.MyClass"> 
    <property name="PaymentService" ref="PaymentService" /> 
    </object> 

내가 코드를 가지고있는 것입니다 :

여기
namespace MyCompany.MyProject.Web 
{ 
    public class MyService : WebService 
    { 
     public IPaymentService PaymentService { get; set; } 
    } 
} 
+0

당신이 http://stackoverflow.com/questions/4229800/how-can-i-get-my-spring-net-webservice-working 보았다 : 우리는 애플리케이션 컨텍스트를했다? – Jaguar

+1

당신은'MyClass' 인스턴스를 구성 합니다만,'MyService' 인스턴스는 설정하지 않습니다. 달성하고자하는 것에 대해 더 많은 정보를 제공하고 이것이 어떤 종류의 응용 프로그램인지 알려주십시오. – Marijn

답변

0

내가하고 결국 것입니다.

IPaymentService paymentService = (IPaymentService) SecurityHelper.GetAppContext().GetObject("PaymentService"); 

     public static IApplicationContext GetAppContext() 
     { 
      if (WebApplicationContext.Current == null) throw new Exception("Spring not initialized"); 
      IApplicationContext context = WebApplicationContext.Current; 
      if (context == null) throw new Exception("Spring context not initialized"); 
      return context; 
     }