Skip to content
Advertisement

How to load an external property file to Spring Boot in Wildfly

I wonder how can I load an external property of my application running inside Wildfly 9 as WAR, I tried to add a java parameter to Wildfly execution but it seems the application did not recognize the properties.

-Dspring.config.location=file:///C:Tempconfigapplication.properties,classpath:application.properties

Is there any way how Spring Boot could read the external property file? I am trying to load and run one Spring Boot application as WAR inside Wildfly.

I’d appreciate any help.

Thanks.

Advertisement

Answer

In my linux system i have an entry in the standalone.xml:

<system-properties>
    <property name="spring.config.location" value="file:/opt/jboss/wildfly/standalone/configuration/"/>
</system-properties>

I just defined the directory here, so it has to end with an “/”.

In the directory “/opt/jboss/wildfly/standalone/configuration/” there is my application.yml.

Advertisement