A mia impressione, RmiProxyFactoryBean
si suppone che generi un'istanza di oggetto proxy di tipo AccountService
che verrà iniettata alla proprietà SimpleObject
nel seguente codice nella proprietà accountService
.In che modo la Spring sa dove ottenere l'oggetto proxy deve essere iniettato?
Quello che non capisco è perché il file XML sembrano indicare primavera per iniettare un oggetto di tipo RmiProxyFactoryBean
a accountService
proprietà di SimpleObject
istanza di un oggetto? Mi aspetto un'istruzione esplicita dal file XML che indichi a Spring come ottenere un'istanza RmiProxyFactoryBean
dall'istanza RmiProxyFactoryBean
invece di iniettare un'istanza RmiProxyFactoryBean
. Trovo questo confuso.
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>
Fonte: http://static.springsource.org/spring/docs/2.5.x/reference/remoting.html (vedi 17.2.2.)
Grazie
Sembra perfetto, grazie Peter – supertonsky