简体   繁体   English

在Spring中配置默认​​URI

[英]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.

相关问题 如何为所有控制器配置默认的@RestController URI 前缀? - How to configure a default @RestController URI prefix for all controllers? 在 Spring Boot 中使用默认模式以编程方式配置 OracleDataSource - Configure OracleDataSource programmatically in Spring Boot with a default schema 在春季使用默认的rest uri端点自动映射CrudRepository - auto-mapping CrudRepository with default rest uri endpoints in spring Spring引导:需要ServletContext来配置默认的servlet处理 - Spring boot : A ServletContext is required to configure default servlet handling Spring JavaConfig配置异常:需要ServletContext来配置默认的servlet处理 - Spring JavaConfig configuration exception : A ServletContext is required to configure default servlet handling 如何配置 spring boot 2 默认返回 xml? - How do you configure spring boot 2 to return xml by default? 我可以在同一个URI上配置HTML和Spring Data REST JSON吗? - Can I configure both HTML and Spring Data REST JSON on the same URI? 使用Spring Boot和annotations配置ViewResolver为HTTP请求找不到URI错误的映射 - Configure ViewResolver with Spring Boot and annotations gives No mapping found for HTTP request with URI error Cloud Native Buildpacks/Paketo with Java/Spring Boot:如何配置不同的 JDK 下载 uri(例如无法访问 github.com) - Cloud Native Buildpacks/Paketo with Java/Spring Boot: How to configure different JDK download uri (e.g. no access to github.com) 春季3.2.0没有uri - Spring 3.2.0 no uri found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM