iis服务器助手广告广告
返回顶部
首页 > 资讯 > 后端开发 > Python >spring-boot-starter-parent的作用详解
  • 856
分享到

spring-boot-starter-parent的作用详解

2024-04-02 19:04:59 856人浏览 八月长安

Python 官方文档:入门教程 => 点击学习

摘要

我们SpringBoot项目pom文件中都会引入spring-boot-starter-parent这样一个依赖,如下: <?xml version="1.0" encodin

我们SpringBoot项目pom文件中都会引入spring-boot-starter-parent这样一个依赖,如下:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="Http://Maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.ruoyi</groupId>
    <artifactId>ruoyi</artifactId>
    <version>2.2.0</version>
    <packaging>jar</packaging>

    <name>ruoyi</name>
    <url>http://www.ruoyi.vip</url>
    <description>若依管理系统</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.1.RELEASE</version>
        <relativePath />
    </parent>
</project>

那spring-boot-starter-parent的作用是什么呢?

其实从字面意思上看是spring-boot-starter的一个parent,那就是引入和定义starter相关的东西。

具体来看可以分为以下两点:

一、统一定义配置:

spring-boot-starter-parent代码如下,定义编码、java版本等:

 <properties>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <resource.delimiter>@</resource.delimiter>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.target>${java.version}</maven.compiler.target>
    </properties>

二、统一依赖及版本:

spring-boot-starter-parent代码如下:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>2.1.1.RELEASE</version>
        <relativePath>../../spring-boot-dependencies</relativePath>
    </parent>

spring-boot-dependencies代码如下:

  <dependencyManagement>
        <dependencies>
           <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot</artifactId>
                <version>2.1.1.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-Redis</artifactId>
                <version>2.1.1.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-quartz</artifactId>
                <version>2.1.1.RELEASE</version>
            </dependency>
</dependencyManagement>

中定义了非常多指定版本的依赖,比如上述的redis、quartz等,这样在具体开发的模块中只需按以下方式引入依赖即可,不必指定版本:

      <!-- redis 缓存操作 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <!-- 定时任务 -->
    <dependency>
           <groupId>org.quartz-scheduler</groupId>
           <artifactId>quartz</artifactId>
    </dependency>

为什么不必指定版本,参考https://www.jb51.net/article/261103.htm

到此这篇关于spring-boot-starter-parent的作用详解的文章就介绍到这了,更多相关spring-boot-starter-parent内容请搜索编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程网!

--结束END--

本文标题: spring-boot-starter-parent的作用详解

本文链接: https://www.lsjlt.com/news/166335.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • spring-boot-starter-parent的作用详解
    我们SpringBoot项目pom文件中都会引入spring-boot-starter-parent这样一个依赖,如下: <xml version="1.0" encoding...
    99+
    2024-04-02
  • Spring Boot 中starter的原理详析
    目录1、springboot 的starter 的启动原理是什么原理来个例子小结2、springboot 是如何找到配置类的3、springboot starter 的bean 是怎...
    99+
    2024-04-02
  • Spring Boot中如何使用Starter
    本篇内容主要讲解“Spring Boot中如何使用Starter”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Spring Boot中如何使用Starter”吧!SpringBoot简介Spri...
    99+
    2023-06-16
  • Spring Boot Starter的示例分析
    这篇文章给大家分享的是有关Spring Boot Starter的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。Spring Boot 简介Spring框架功能很强大,但是就算是一个很简单的项目,我们也要...
    99+
    2023-05-31
    spring boot starter
  • 使用spring-boot如何实现整合dubbo中的Spring-boot-dubbo-starter
    使用spring-boot如何实现整合dubbo中的Spring-boot-dubbo-starter?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。在application.p...
    99+
    2023-05-31
    springboot art dubbo
  • maven插件spring-boot-starter-tomcat的使用方式
    目录tomcat内嵌到web项目中1.pom.xml 配置2.tomcat使用maven内嵌入到web项目需要jdk运行环境3.springmvc依赖4.编写表现层代码5.配置web...
    99+
    2024-04-02
  • gateway与spring-boot-starter-web冲突问题的解决
    gateway与spring-boot-starter-web 冲突 环境: SpringCloud 版本 ---- Finchley.SR2 SpringBoot 版本 ---- ...
    99+
    2024-04-02
  • spring boot 自定义starter的实现教程
    spring boot 使用 starter 解决了很多配置问题, 但是, 他是怎么来解决这些问题的呢?这里通过一个简单的例子, 来看一下, starter是怎么来设置默认配置的.一. 建 starter 项目自定义的starter...
    99+
    2023-05-30
    spring boot 自定义
  • spring-boot-starter-validation 校验参数的实现
    目录一、前言二、常用注解三、定义分组四、定义需要校验的对象五、在handler 即 Controller中 校验六、定义全局异常处理类七、测试效果八、嵌套对象的校验九、自定义注解(自...
    99+
    2024-04-02
  • Spring MVC 详解 (Spring Boot)
    Spring MVC 详解 - Spring Boot 一、什么是 Spring MVC1.1 MVC 定义1.2 MVC 和 Spring MVC 的关系1.3 学习目的 二、Spring MVC 创建和连接2.1 创建 Sp...
    99+
    2023-12-22
    spring mvc spring boot java 后端
  • 如何使用spring boot starter redis配置文件
    本篇文章为大家展示了如何使用spring boot starter redis配置文件,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。spring-boot-starter-Redis主要是通过配置R...
    99+
    2023-05-31
    springboot starter redis
  • SpringCloud-Spring Boot Starter使用测试实例分析
    这篇文章主要介绍了SpringCloud-Spring Boot Starter使用测试实例分析的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇SpringCloud-Spring ...
    99+
    2023-07-02
  • Spring boot——Actuator 详解
    一、什么是 Actuator Spring Boot Actuator 模块提供了生产级别的功能,比如健康检查,审计,指标收集,HTTP 跟踪等,帮助我们监控和管理Spring Boot 应用。 这个模块是一个采集应用内部信息暴露给外部的模...
    99+
    2023-09-22
    java spring boot
  • SpringCloud-Spring Boot Starter使用测试及问题小结
    目录Spring Boot Starter是什么?以前传统的做法使用 Spring Boot Starter 之后starter 的理念:starter 的实现:创建Spring B...
    99+
    2024-04-02
  • Spring Boot 使用Druid详解
    Druid是Java语言中最好的数据库连接池,并且能够提供强大的监控和扩展功能,下面来说明如何在 SpringBoot 中配置使用Druid。步骤: 在pom.xml中加载依赖 在application.properties中加入数据源配置...
    99+
    2023-05-31
    spring boot druid
  • 解读动态数据源dynamic-datasource-spring-boot-starter使用问题
    目录dynamic-datasource-spring-boot-starter使用特性约定使用方法总结dynamic-datasource-spring-boot-starter使...
    99+
    2023-03-21
    解读动态数据源 dynamic-datasource-spring-boot-starter
  • 如何解决gateway与spring-boot-starter-web冲突问题
    本篇内容介绍了“如何解决gateway与spring-boot-starter-web冲突问题”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!...
    99+
    2023-06-20
  • 详解Spring Boot中Controller用法
    ControllerController是SpringBoot里最基本的组件,他的作用是把用户提交来的请求通过对URL的匹配,分配个不同的接收器,再进行处理,然后向用户返回结果。他的重点就在于如何从HTTP请求中获得信息,提取参数,并分发给...
    99+
    2023-05-31
    spring boot controller
  • 详解Spring boot操作文件的多种方式
    目录一、获取文件路径1、class.getResource(path)2、ClassLoader.getResource(path)3、项目路径二、操作文件的三种方式1、ClassP...
    99+
    2024-04-02
  • 动态数据源dynamic-datasource-spring-boot-starter怎么使用
    这篇文章主要讲解了“动态数据源dynamic-datasource-spring-boot-starter怎么使用”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“动态数据源dynamic-da...
    99+
    2023-07-05
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作