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项目
相关推荐
java_t_t1 天前
Java属性解析映射到Json
java·json
先做个垃圾出来………1 天前
Python位运算及操作
java·前端·python
你怎么知道我是队长1 天前
C语言---字符串
java·c语言·算法
rannn_1111 天前
【Java项目】中北大学Java大作业|电商平台
java·git·后端·课程设计·中北大学
资生算法程序员_畅想家_剑魔1 天前
Java常见技术分享-26-事务安全-锁机制-常见的锁实现
java·开发语言
座山雕~1 天前
spring
java·后端·spring
草原印象1 天前
Spring、SpringMVC、Mybatis框架整合实战视频课程
java·spring·mybatis
乌日尼乐1 天前
【Java】IO流完全指南
java·后端
Java水解1 天前
Spring Boot:Java开发的神奇加速器(二)
spring boot·后端
Coder_Boy_1 天前
基于SpringAI的企业级智能教学考试:基础资源构建模块
人工智能·spring boot