Search code examples
javaspringspring-elsystem-properties

What is systemProperties in Spring and where to find it?


I'm reading Spring In Action book and there's is an example:

public BlankDisc(@Value("#{systemProperties['disc.title']}" String title){
}

But what is systemProperties here and where to declare it? I thought it was application.properties file and added disc.title=Beatles there. But the value of title variable is null when the bean is created. I can inject the value of disc.title if i use @Value("${disc.title}") by the way.


Solution

  • This is the property that will be set while starting the jar like "java -Dproperty.name="value" -jar app.jar"