I want to load data from the pom.xml file using application.properties and then load this value using @Value in a specific class.
So in pom.xml:
<properties>
<takeScreenshots>true</takeScreenshots>
</properties>
Then in application.properties:
selenium.screenshotOnFailure=${takeScreenshots}
And then specific class:
@Configuration
@PropertySource("classpath:application.properties")
public class PropertiesContext {
@Value("${selenium.screenshotOnFailure}")
private String screenshotOnFailure;
@Bean("screenshotOnFailure")
public boolean takeScreenshotOnFailure() {
return Boolean.parseBoolean(screenshotOnFailure);
}
But it doesn't work.
During runtime I see that program return
String ${selenium.screenshotOnFailure}
instead of boolean.
It seems the program doesn't load value from pom.xml.
What should I do?