目录
一、Starters是什么?
Starters
可以理解为启动器,它包含了一系列可以集成到应用里面的依赖包,你可以一站式集成
Spring
及其他技术,而不需要到处找示例代码和依赖包。如你想使用
Spring JPA
访问数据库,只要
加入
spring-boot-starter-data-jpa
启动器依赖就能使用了。
Starters
包含了许多项目中需要用到的
依赖,它们能快速持续的运行,都是一系列得到支持的管理传递性依赖。
二、Starters命名
Spring Boot
官方的启动器都是以
spring-boot-starter-
命名的,代表了一个特定的应用类型。第三
方的启动器不能以
spring-boot
开头命名,它们都被
Spring Boot
官方保留。一般一个第三方的应该
这样命名,像
mybatis
的
mybatis-spring-boot-starter
。
三、Starters分类
1. Spring Boot应用类启动器
2. Spring Boot生产启动器
3. Spring Boot技术类启动器
4. 常用starters
spring-boot-starter-web
嵌入
tomcat
和
web
开发需要
servlet
与
jsp
支持
spring-boot-starter-data-jpa
数据库支持
spring-boot-starter-data-redis redis
数据库支持
spring-boot-starter-data-solr solr
支持
mybatis-spring-boot-starter
第三方的
mybatis
集成starter
总结
以上就是今天要讲的内容,本文仅仅简单介绍了springboot中的启动类的理解以及使用,而starterts的一站式集成其他工具大大简化了以往配置文件的编写。