Hi,
I am calling a SOAP web service using Spring's WebServiceGatewaySupport.
It works fine, but I now need to externalize the endpoint ipAddress. Since the
endpoint is used in several methods in the class, I've defined the endpoint as
a class variable.
I've defined a text property file, util
roperties in applicationContext.xml, and @Value in the class.
When I don't reference the value in my class, the app starts fine so I know Spring is finding
my properties file and correlating it to the @Value.
However, I get a 'could not resolve placeholder' error with @Value("${myProp.ipAddress}") syntax.
With @Value("${myProp['ipAddress']}") syntax I get a null value in the ipAddress field.
I've tried both the static $ and dynamic # tags, to no avail. Is it possible that Spring won't
retrieve the value until after the class is instantiated ? If so, how do I get an externalized
endpoint ipAddress into my class ?
The code is below.
Please help !!!
appContext
Code:
<util:properties id="myProp" location="/WEB-INF/properties/myProperties"/>
property file
Code:
ipAddress=http://192.168.22.33:5897
@Value bits in the class
Code:
@Service
public class MyClass extends WebServiceGatewaySupport implements IMyClass
{
@Value("${myProp.ipAddress}") // (or @Value("${myProp['ipAddress']}")
public void setIpAddress(String ipAddress)
{
this.ipAddress = ipAddress;
}
MySoapProxy mySoapProxy = new MySoapProxy(ipAddress + "/MySoapService?wsdl");
...