To my impression, RmiProxyFactoryBean
is supposed to produce a proxy object instance that is of type AccountService
that will be injected to accountService
property of SimpleObject
instance in the following code.
What I do not understand is why does the XML file seem to instruct Spring to inject an object of RmiProxyFactoryBean
type to accountService
property of SimpleObject
object instance? I'm expecting an explicit instruction from the XML file that tells the Spring how to get an AccountService
instance from RmiProxyFactoryBean
instance instead of injecting an RmiProxyFactoryBean
instance. I find this confusing.
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>
Source: http://static.springsource.org/spring/docs/2.5.x/reference/remoting.html (see 17.2.2.)
Thanks