Follow-up -- Success:
I was able to get a session-scoped RMI proxy with a little finagling.
Code:
<bean id="myService" class="com.company.MyServiceDelegator" scope="session">
<aop:scoped-proxy />
<property name="remoteMyService">
<bean class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
<property name="serviceUrl">
[...]*
</property>
<property name="serviceInterface" value="com.company.MyService"/>
<property name="lookupStubOnStartup" value="false" />
<property name="refreshStubOnConnectFailure" value="true" />
</bean>
</property>
</bean>
Code:
public class MyServiceDelegator implements MyService {
private MyService remoteMyService;
public MyService getRemoteMyService() {
return remoteMyService;
}
public void setRemoteMyService(final MyService remoteMyService) {
this.remoteMyService= remoteMyService;
}
public void serviceCall(...) {
remoteMyService.serviceCall(...);
}
}
Now, I can transparently inject myService into any bean that needs to use the MyService interface.
* The [...] represents an unsolved problem. In actuality, I subclassed RmiProxyFactoryBean to override the setServiceUrl method, but that's pretty disgusting and shouldn't be necessary.