blue-sky
blue-sky

Reputation: 53806

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 :

<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.

I could use something like :

<bean id="myBean" class="org.myBean" "factory-method=getDefaultUri"/>

the bean class "myBean" is then defined like :

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.

Are there other implementations other than what I outlined ?

Upvotes: 1

Views: 2082

Answers (1)

Lucas Oliveira
Lucas Oliveira

Reputation: 883

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...

public interface BeanPostProcessor

"Factory hook that allows for custom modification of new bean instances, e.g. checking for marker interfaces or wrapping them with proxies."

More info: http://docs.spring.io/spring/docs/3.0.x/api/org/springframework/beans/factory/config/BeanPostProcessor.html

Upvotes: 1

Related Questions