springboot快速入门
springboot是对spring的封装,基于约定大于配置的思想。SpringBoot要求,项目要继承SpringBoot的起步依赖spring-boot-starter-parent也就是在创建springboot工程的时候,所有的项目都需要依赖parent。
- 创建maven项目
- 添加springboot的起步依赖
<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.0.1.RELEASE</version></parent>
- 集成springmvc对controller层的开发,引入对web的起步依赖
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
- 编写引导类,使用@SpringBootApplication注解注明引导类
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
public class QuickStartApplication {public static void main(String[] args) {SpringApplication.run(QuickStartApplication.class, args);}
}
- 启动springboot项目