First, System configuration file
1.application.properties is the default configuration file after you create a new Springboot project
Examples of configuration such as the following
server.port=8080server.context-path=/girl
2. Recommended ways to use APPLICATION.YML
Examples of configuration such as the following
Server: 8082 Context-path:/girl
Second, YAML
YAML Language Tutorials
Third, practical application
[e-mail protected] Usage
Application.yml
Server
port:8082
Cupsize:b
Age:18
Content: "Cupsize: ${cupsize}, Age: ${age}"
The corresponding injection method in Hellocontroller
@RestController
public class Hellocontroller {
@Value ("${cupsize}")
Private String cupsize;
@Value ("${age}")
Private String age;
@Value ("${content}")
Private String content;
@RequestMapping (value = "/hello", method = Requestmethod.get)
Public String say () {
Return cupsize+ "," +age+ ";" +content;
}
}
Browser output is b,18;cupsize:b, age:18
2.
Spring Boot Project Property configuration