JavaTec
JavaTec

Reputation: 1044

Spring Boot 1.3.5: expanding variables within application.properties file

We are using Spring Boot 1.3.5, which loads external application.properties using @PropertySource("file:C:/tmp/application.properties"). Here is how application.properties looks like:

env=prod
instance=EAST
emailSubject=${env}-${instance}: An error occurred

The code is able to see/get the correct values for env and instance variables, but the emailSubject variable is not getting substituted. And when we print it in the code, it shows

"${env}-${instance}: An error occurred"

How to make emailSubject be correctly substituted to show

"prod-EAST: An error occurred"

Upvotes: 1

Views: 567

Answers (1)

Thomas Kåsene
Thomas Kåsene

Reputation: 5449

Without knowing much more about how it's set up, and seeing as the contents of the properties-file you posted is valid, I'll have to assume there's something wrong with how the contents is being read or used.

Upvotes: 1

Related Questions