springboot快速入门

springboot快速入门

springboot是对spring的封装,基于约定大于配置的思想。SpringBoot要求,项目要继承SpringBoot的起步依赖spring-boot-starter-parent也就是在创建springboot工程的时候,所有的项目都需要依赖parent。

  1. 创建maven项目
  2. 添加springboot的起步依赖
java 复制代码
 <parent>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-parent</artifactId>
 <version>2.0.1.RELEASE</version>
 </parent>
  1. 集成springmvc对controller层的开发,引入对web的起步依赖
java 复制代码
   <dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-web</artifactId>
   </dependency>
  1. 编写引导类,使用@SpringBootApplication注解注明引导类
java 复制代码
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);
    }
}
  1. 启动springboot项目
相关推荐
青云计划1 天前
知光项目知文发布模块
java·后端·spring·mybatis
赶路人儿1 天前
Jsoniter(java版本)使用介绍
java·开发语言
探路者继续奋斗1 天前
IDD意图驱动开发之意图规格说明书
java·规格说明书·开发规范·意图驱动开发·idd
消失的旧时光-19431 天前
第十九课:为什么要引入消息队列?——异步系统设计思想
java·开发语言
yeyeye1111 天前
Spring Cloud Data Flow 简介
后端·spring·spring cloud
A懿轩A1 天前
【Java 基础编程】Java 面向对象入门:类与对象、构造器、this 关键字,小白也能写 OOP
java·开发语言
乐观勇敢坚强的老彭1 天前
c++寒假营day03
java·开发语言·c++
biubiubiu07061 天前
谷歌浏览器无法访问localhost:8080
java
+VX:Fegn08951 天前
计算机毕业设计|基于springboot + vue鲜花商城系统(源码+数据库+文档)
数据库·vue.js·spring boot·后端·课程设计
大黄说说1 天前
新手选语言不再纠结:Java、Python、Go、JavaScript 四大热门语言全景对比与学习路线建议
java·python·golang