当前位置: 代码迷 >> 综合 >> springboot6--->spring-boot的starter介绍以及实现自己的starter
  详细解决方案

springboot6--->spring-boot的starter介绍以及实现自己的starter

热度:54   发布时间:2023-10-24 15:10:45.0

1、在spring boot中starter的含义

      官网的说法是:Starters are a set of convenient dependency descriptors that you can include in your application. You get a one-stop shop for all the Spring and related technologies that you need without having to hunt through sample code and copy-paste loads of dependency descriptors. For example, if you want to get started using Spring and JPA for database access, include the spring-boot-starter-data-jpa dependency in your project.

       翻译过来就是:启动程序是一组方便的依赖关系描述符,可以包含在应用程序中。您可以获得所需的所有Spring和相关技术的一站式服务,而不必搜索示例代码和复制粘贴大量依赖描述符。例如,如果您想开始使用Spring和JPA进行数据库访问,请在项目中包含spring-boot-starter-data-jpa依赖项。

       我们可以简单的理解为starter是一个组件,这个组件可以帮我们完成某些框架、中间件的整合,比如spring-boot-starter-web就是一个starter,这个组件能够帮我们自动配置整合好springmvc,这样我们就能直接使用springmvc的功能进行开发。

 

2、spring boot starter的命名规则

      规则1:spring 官方开发的组件命名格式:spring-boot-starter-XXX

                   example:spring-boot-starter-aop

                                    spring-boot-starter-cache

                                    spring-boot-starter-data-mongodb

                                    spring-boot-starter-web

      规则2:第三方开发的starter命名格式:XXX-spring-boot-starter

                   example:mybatis-spring-boot-starter

                                    dubbo-spring-boot-starter

                                    rocketmq-spring-boot-starter

 

3、自定义spring boot的starter

       待续。。。

 

 

 

 

 

  相关解决方案