I'm having some trouble trying to pass JVM arguments to a Spring Boot application from build.gradle file.
My build.gradle looks like this:
buildscript ...
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
...
def devConfigFolder = "/abc"
applicationDefaultJvmArgs = ["-DconfigFolder=$devConfigFolder"]
dependencies {
...
}
And the class where I try to use the placeholder:
@Component
public class PClass {
private static final String CONF = "configFolder";
@Value("${" + CONF+ "}")
private String configFolder;
}
And this is the exception I'm receiving:
IllegalArgumentException: Could not resolve placeholder 'configFolder' in value "${configFolder}"
I've tried with bootRun{jvmArgs}, but it doesn't work.