2

I am using spring boot application with appliaction.properties. In the project there is XML file written by another company to configure Stomp, and there is hardcoded IP of the server, but I want to change those IP to take value from application.properties. is there any way to do it?

application.properties

property.env=SLA
property.endpoint=http://172.1.1.139/router

tcmanager.xml

<tcmanager>

    <channelbuilders>
        <channelbuilder>
            <class>com.company.tc.stomp.TcStompChannelBuilder</class>
            <config>
                <properties>
                    <property>brokerURL=[property.endpoint]</property> //this is the place
                    <property>login=login</property>
                    <property>passcode=pass</property>
                </properties>
                <in> [...] </in>
                <out> [...]</out>
            </config>
        </channelbuilder>
    </channelbuilders>

    <processingbuilders>
        <processingbuilder>
            <class>com.company.tc.template.camel.MainProcessingBuilder</class>
            <config>
                <properties>
                    <property>p1=1</property>
                </properties>
            </config>
        </processingbuilder>
    </processingbuilders>

</tcmanager>
Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
Jacek Grzelaczyk
  • 783
  • 2
  • 9
  • 21
  • `brokerURL=${property.endpoint}` normally, with some copying of filtered resources (filling in the XML in a target copy). Whether this is the case here I do not know. Could do it yourself with _maven_ or _gradle_ – Joop Eggen May 18 '21 at 10:39
  • @JoopEggen It doesn't work. ERROR: Problem starting the connection, monitor will try start connection automatically, error: Illegal character in path at index 1: ${property.endpoint} java.net.URISyntaxException: Illegal character in path at index 1: ${property.endpoint} – Jacek Grzelaczyk May 18 '21 at 10:51
  • 1
    See https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html . The principle is: your XML is a templated. During build it is copied to your software product. With filtering substituting `${...} `. This assumes a couple of things, But is not unusual in a spring context. Maybe an answer is given soon – Joop Eggen May 18 '21 at 10:57

0 Answers0