[英]Configure a default URI in Spring
Reading the doc about configuring a defaultUri ( http://docs.spring.io/spring-ws/site/reference/html/client.html ) I have this : 阅读有关配置defaultUri的文档( http://docs.spring.io/spring-ws/site/reference/html/client.html )我有以下内容:
<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"/>
<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
<constructor-arg ref="messageFactory"/>
<property name="defaultUri" value="http://example.com/WebService"/>
</bean>
I want to amend the property defaultUri so that it is read from a property configured in a different bean. 我想修改属性defaultUri,以便从另一个bean中配置的属性中读取它。
I could use something like : 我可以使用类似:
<bean id="myBean" class="org.myBean" "factory-method=getDefaultUri"/>
the bean class "myBean" is then defined like : 然后,将bean类“ myBean”定义为:
public class myBean {
public String getDefaultUri(){
///invoke other method which get the URI
return "myUri"
}
}
So basically I want to configure the defaultUri using a property. 所以基本上我想使用属性来配置defaultUri。
Are there other implementations other than what I outlined ? 除了我概述的以外,还有其他实现吗?
Take a look at BeanPostProcessor interface, I believe is what you are looking for ... I use to do some processing in a scenario like this... 看一下BeanPostProcessor接口,我相信这就是您要寻找的...我曾经在这种情况下进行一些处理...
public interface BeanPostProcessor
"Factory hook that allows for custom modification of new bean instances, eg checking for marker interfaces or wrapping them with proxies."
“工厂钩子允许自定义修改新的bean实例,例如检查标记接口或将它们包装成代理。”
More info: http://docs.spring.io/spring/docs/3.0.x/api/org/springframework/beans/factory/config/BeanPostProcessor.html 更多信息: http : //docs.spring.io/spring/docs/3.0.x/api/org/springframework/beans/factory/config/BeanPostProcessor.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.