1.新建maven工程web
2.在pom文件中引入SpringBoot相關依賴spring
<parent>springboot
<groupId>org.springframework.boot</groupId>maven
<artifactId>spring-boot-starter-parent</artifactId>ide
<version>1.5.1.RELEASE</version>spring-boot
</parent>spa
<dependencies>ci
<dependency>it
<groupId>org.springframework.boot</groupId>io
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
3.新建啓動類
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
也能夠用spring intilizer來生成springboot的模板