springboot快速入门

springboot快速入门

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

  1. 创建maven项目
  2. 添加springboot的起步依赖
 <parent>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-parent</artifactId>
 <version>2.0.1.RELEASE</version>
 </parent>
  1. 集成springmvc对controller层的开发,引入对web的起步依赖
   <dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-web</artifactId>
   </dependency>
  1. 编写引导类,使用@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);
    }
}
  1. 启动springboot项目

相关推荐

  1. springboot快速入门

    2023-12-08 17:16:05       38 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-08 17:16:05       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-08 17:16:05       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-08 17:16:05       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-08 17:16:05       20 阅读

热门阅读

  1. 虚拟化之Stage2地址翻译

    2023-12-08 17:16:05       36 阅读
  2. 对音频打上标签,从标签开始播放

    2023-12-08 17:16:05       37 阅读
  3. oceanBase存储返回多个值

    2023-12-08 17:16:05       38 阅读
  4. 【android开发-20】android中notification的用法讲解

    2023-12-08 17:16:05       30 阅读
  5. [python高级编程]:01-数据结构

    2023-12-08 17:16:05       42 阅读
  6. 机器学习算法汇总--GBDT、XGBoost等

    2023-12-08 17:16:05       40 阅读
  7. c++的排序算法

    2023-12-08 17:16:05       29 阅读