最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

SpringBoot所管理的依賴和需要的依賴沖突問(wèn)題及解決

 更新時(shí)間:2026年05月31日 09:59:51   作者:起名困難綜合癥  
這篇文章主要介紹了SpringBoot所管理的依賴和需要的依賴沖突問(wèn)題及解決過(guò)程,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

背景

在使用springboot2.7.7 集成 elasticsearch7.9.3時(shí) 啟動(dòng)報(bào)錯(cuò)

Error creating bean with name 'client' defined in class path resource 
[com/sgp/config/EsConfig.class]: Bean instantiation via factory method failed; nested exception 
is org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[org.elasticsearch.client.RestHighLevelClient]: Factory method 'client' threw exception; nested 
exception is java.lang.NoClassDefFoundError: 
org/elasticsearch/common/xcontent/DeprecationHandler at 
org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.24.jar:5.3.24]

查看后發(fā)現(xiàn)當(dāng)前項(xiàng)目里面不僅有我引入的 es 7.9.3 版本的jar 還有springboot 2…7.7 所默認(rèn)加入7.13.1版jar,最初我的pom是這樣的

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>
    <modules>
        <module>orders</module>
    </modules>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.7</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.sgp</groupId>
    <artifactId>es-study</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>es-study</name>
    <description>es-study</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>7.9.3</version>
        </dependency>
        .....

解決方案

網(wǎng)上有的說(shuō)像我以上的這種寫的指定依賴版本 就可以覆蓋springboot所管理的依賴,但很明顯在我這里并沒(méi)有用,于是通過(guò)在 <properties></properties> 里加上指定版本 然后再 dependency 中通過(guò)${}引入解決掉的 (先記錄一下 后面找到為什么的時(shí)候在寫原因)

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>
    <modules>
        <module>orders</module>
    </modules>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.7</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.sgp</groupId>
    <artifactId>es-study</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>es-study</name>
    <description>es-study</description>
    <properties>
        <java.version>1.8</java.version>
        <elasticsearch.version>7.9.3</elasticsearch.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
.....

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Java Filter過(guò)濾器的使用教程

    Java Filter過(guò)濾器的使用教程

    Filter也稱之為過(guò)濾器,它是Servlet技術(shù)中最實(shí)用的技術(shù),Web開發(fā)人員通過(guò)Filter技術(shù),對(duì)web服務(wù)器管理的所有web資源:例如Jsp, Servlet, 靜態(tài)圖片文件或靜態(tài) html 文件等進(jìn)行攔截,從而實(shí)現(xiàn)一些特殊的功能
    2023-01-01
  • java對(duì)指定目錄下文件讀寫操作介紹

    java對(duì)指定目錄下文件讀寫操作介紹

    本文將詳細(xì)介紹java對(duì)指定目錄下文件的讀寫功能實(shí)現(xiàn),需要的朋友可以參考下
    2012-11-11
  • Java調(diào)用第三方http接口的常用方式總結(jié)

    Java調(diào)用第三方http接口的常用方式總結(jié)

    這篇文章主要介紹了Java調(diào)用第三方http接口的常用方式總結(jié),具有很好的參考價(jià)值,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-06-06
  • springboot調(diào)用python文件的詳細(xì)方案

    springboot調(diào)用python文件的詳細(xì)方案

    這篇文章主要為大家詳細(xì)介紹了springboot調(diào)用python文件的詳細(xì)方案,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2025-04-04
  • 如何使用BeanUtils.copyProperties進(jìn)行對(duì)象之間的屬性賦值

    如何使用BeanUtils.copyProperties進(jìn)行對(duì)象之間的屬性賦值

    這篇文章主要介紹了使用BeanUtils.copyProperties進(jìn)行對(duì)象之間的屬性賦值,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-05-05
  • Spring Security認(rèn)證提供程序示例詳解

    Spring Security認(rèn)證提供程序示例詳解

    這篇文章主要給大家介紹了關(guān)于Spring Security認(rèn)證提供程序的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用Spring Security具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-05-05
  • java實(shí)現(xiàn)RTF文件查看器(附帶源碼)

    java實(shí)現(xiàn)RTF文件查看器(附帶源碼)

    這篇文章主要介紹了一個(gè)基于?Java?Swing?的?RTF?文件查看器,既可作為輕量級(jí)桌面應(yīng)用,也可嵌入到更大規(guī)模的管理系統(tǒng)中,滿足用戶對(duì)?RTF?文檔的即時(shí)預(yù)覽、樣式保真和簡(jiǎn)單導(dǎo)航需求
    2025-06-06
  • 模擬Spring的簡(jiǎn)單實(shí)現(xiàn)

    模擬Spring的簡(jiǎn)單實(shí)現(xiàn)

    本文的主要內(nèi)容就是學(xué)習(xí)Spring的開端,模擬一下Spring的實(shí)現(xiàn),感興趣的小伙伴可以參考一下
    2015-10-10
  • Spring使用RestTemplate模擬form提交示例

    Spring使用RestTemplate模擬form提交示例

    本篇文章主要介紹了Spring使用RestTemplate模擬form提交示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-03-03
  • SpringBoot 二維碼生成base64并上傳OSS的實(shí)現(xiàn)示例

    SpringBoot 二維碼生成base64并上傳OSS的實(shí)現(xiàn)示例

    本文主要介紹了SpringBoot 二維碼生成base64并上傳OSS的實(shí)現(xiàn)示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2022-05-05

最新評(píng)論

高清| 上思县| 若尔盖县| 天津市| 丽水市| 榆林市| 肇州县| 平顺县| 呈贡县| 雅安市| 绥中县| 平舆县| 新民市| 和平县| 盱眙县| 富民县| 沿河| 晋中市| 那坡县| 耿马| 巴南区| 抚松县| 江陵县| 通河县| 栾城县| 东光县| 赤壁市| 南江县| 马尔康县| 天等县| 蓝山县| 阳西县| 潍坊市| 莲花县| 临安市| 鹿邑县| 兴国县| 大同县| 会泽县| 安国市| 台中县|