1、根项目gradle.properties
org.gradle.jvmargs=-Xmx256m -XX:MetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError
systemProp.SERVICE_NAMESPACE=myns
2、build.gradle
run {
systemProperties System.getProperties()
}
3、java
public class TestApplication {
public static void main(String[] args) {
System.out.println(System.getProperty("SERVICE_NAMESPACE"));
SpringApplication.run(TestApplication.class, args);
}
}
完成。