环境
● jdk1.8
● maven 3.6.1
● springboot 2.7.8
● IDEA 2022
HelloWorld程序
0x01 idea快速配置springboot
0x02 起步依赖
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.8</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
0x03 启动引导类
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
0x04 业务类
@RestController
public class HelloController {
@RequestMapping("/hello")
public String hello(){
return "hello";
}
}
配置文件
0x01 application.properties配置格式
1 properties
server.port=8080
2 yml
server:
port: 8080