KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm using Spring to handle RMI calls to some remote server. It is straightforward to construct an application context and obtain the bean for remote invocations from within the client: ApplicationContext context = new ApplicationContext("classpath:context.xml"); MyService myService = (MyService ) context.getBean( "myService " ); However I don't see a simple way to pass properties into the configuration. For example if I want to determine the host name for the remote server at runtime within the client. I'd ideally have an entry in the Spring context like this: <bean id="myService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean"> <property name="serviceUrl" value="rmi://${webServer.host}:80/MyService"/> <property name="serviceInterface" value="com.foo.MyService"/> </bean> and pass the properties to the context from the client as a parameter. I can use a PropertyPlaceholderConfigurer in the context to substitute for these properties, but as far as I can tell this only works for properties read from a file. I have an implementation that addresses this (added as an answer) but I'm looking for a standard Spring implementation to avoid rolling my own. Is there another Spring configurer (or anything else) to help initialise the configuration or am I better off looking at java config to achieve this?
Tags (comma-separated)
Save Edits
Cancel