Springboot start receiving parameters
Springboot startup can pass startup parameters to the program through the java-jar xxx.jar parameter.
Passing parameters through args [] is very inelegant, and different systems will have singularities. The windows system will write a line of identification in the parameters, but the Linux system will not, and a few parameters will be arranged according to the number of digits in the array.
Here's an elegant way to inject attributes through @ Value with the help of attributes in application.properties.
The code is as follows: @ Componentbr/ > @ Component
@ Value ("${contextPath}") private String contextPath;public String getPath () {return contextPath;}
}
The installation package path defaults to empty
ContextPath=
Start with java-jar xxx.jar-- contextPath= "/ home/app/"