idea快速创建一个springboot项目并跑起来
《今天开始学/复习springboot》
- 环境搭建(自己搭)
- File->New Project->Spring Initializr:Project SDK:选择你的jdk (我的1.8),chose initializr Service URL选择 defult
- ->next 默认就行,起名字的随便写
- 三个包:
- Spring Boot的版本仲裁中心,控制了所有依赖的版本号
<groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.1.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent>- 一个正常springboot项目启动,依赖的基础包:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> - appliciation.properity->ctrl+F6 改名:appliciation.yml
配置如下:server: port: 8080 servlet: context-path: / - 启动xxxAppliciation Path:src/main/java/com.xxx.xxx包下找到main启动即可