Search code examples
javaspring-mvcspring-bootclasspathapplication.properties

How to directly read application.property value into another configuration xml file in spring boot


I have specified some webservice endpoints into applicaiton.properties file as below application.properties

config.middleware.soap.service.endpoint.sample=http://xxx.xxx/sample/

Now i want to directly use those values into another configuration file that is in my case root-context.xml file for creating soap class using jax-ws client. but the property is never understood by spring boot if i refer it from applicaiton.properties value. why not? if i directly provide the endpoint it works. what is the simplest way to use application.properties file values into anther configuration file? root-context.xml

<jaxws:client id="sampleClient" serviceClass="com.sample.wsdl.sample"
        address="${config.middleware.soap.service.endpoint.sample}">

        ...
    </jaxws:client>

in my case both the root-context and application.properties file reside in src/main/resources folder.. so i assume both the files gets loaded on classpath when the applcation boot strap.


Solution

  • It worked finally when i used it in below mentioned way

    <jaxws:client id="acctInqClient" serviceClass="com.ge.india.capital.wsdl.spine.AcctInq"
            address="#{environment['config.middleware.soap.service.endpoint.sample']}">
    

    provided, i declared one property in the name config.middleware.soap.service.endpoint.sample in the applicaiton.properties file.

    But i would like to know why only ${config.middleware.soap.service.endpoint.sample} didn't work. thank you.