1

How to inject a string that contains ${...} in spring application.properites

I wanted to provide following key value pair in the applicaiton.properties file in spring and wanted spring to ignore the place holder without resolving it.

output.folder=${date:now:yyyy-MM-dd}/success/${header.CamelFileName} 

But while loading spring is trying to provide the place holder value, for instance header.CamelFileName and would throw exception. Is there any way this can be escaped?

Jens
  • 67,715
  • 15
  • 98
  • 113
mac
  • 543
  • 1
  • 6
  • 17

1 Answers1

0

You can try something like this, to escape a placeholder:

$=$
output.folder=${date:now:yyyy-MM-dd}/success/${$}{header.CamelFileName} 

It could look a little bit tricky, but you have to escape a dollar sign, in order not to turn a ${header.CamelFileName} into reference

Stanislav
  • 27,441
  • 9
  • 87
  • 82