Để hiển thị của tôi, RmiProxyFactoryBean
được cho là tạo ra một đối tượng proxy có kiểu AccountService
sẽ được tiêm vào accountService
thuộc tính của SimpleObject
thể hiện trong đoạn mã sau.Làm thế nào để Xuân biết nơi cần lấy đối tượng proxy cần được tiêm?
Điều tôi không hiểu là tại sao tệp XML có vẻ hướng dẫn Spring tiêm một đối tượng thuộc tính RmiProxyFactoryBean
loại accountService
của cá thể đối tượng SimpleObject
? Tôi đang mong đợi một hướng dẫn rõ ràng từ tệp XML cho Spring biết cách lấy một cá thể AccountService
từ ví dụ RmiProxyFactoryBean
thay vì tiêm một cá thể RmiProxyFactoryBean
. Tôi thấy điều này khó hiểu.
public class SimpleObject {
private AccountService accountService;
public void setAccountService(AccountService accountService) {
this.accountService = accountService;
}
}
<bean class="example.SimpleObject">
<property name="accountService" ref="accountService"/>
</bean>
<bean id="accountService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
<property name="serviceUrl" value="rmi://HOST:1199/AccountService"/>
<property name="serviceInterface" value="example.AccountService"/>
</bean>
Nguồn: http://static.springsource.org/spring/docs/2.5.x/reference/remoting.html (xem 17.2.2).
Cảm ơn
Trông hoàn hảo, cảm ơn Peter – supertonsky