SpringBoot 添加 minio okhttp 报错

报错截图:报错内容


***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    io.minio.S3Base.<clinit>(S3Base.java:104)

The following method did not exist:

    'okhttp3.RequestBody okhttp3.RequestBody.create(byte[], okhttp3.MediaType)'

The method's class, okhttp3.RequestBody, is available from the following locations:

    jar:file:/Users/liuzhenda/.m2/repository/com/squareup/okhttp3/okhttp/3.14.9/okhttp-3.14.9.jar!/okhttp3/RequestBody.class

The class hierarchy was loaded from the following locations:

    okhttp3.RequestBody: file:/Users/liuzhenda/.m2/repository/com/squareup/okhttp3/okhttp/3.14.9/okhttp-3.14.9.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of okhttp3.RequestBody

贼恶心 ,明明在 pom 中已经指定了 okhttp 的版本 运行起来还是 3.14.9

使用 mvn dependency:tree 查看 jar 包的引用也只有 minio 使用了

实际上 springBoot 也使用了 在父工程中点击进去

就会发现原来是这小子在这捣乱 他 mmmm 的 大 sa 鼻

在父 pom 中添加 okhttp 4.8.1 的依赖 覆盖 3.14.9 

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
        <druid.version>1.2.20</druid.version>
        <bitwalker.version>1.21</bitwalker.version>
        <swagger.version>3.0.0</swagger.version>
        <kaptcha.version>2.3.3</kaptcha.version>
        <pagehelper.boot.version>1.4.7</pagehelper.boot.version>
        <fastjson.version>2.0.43</fastjson.version>
        <oshi.version>6.4.13</oshi.version>
        <commons.io.version>2.13.0</commons.io.version>
        <poi.version>4.1.2</poi.version>
        <velocity.version>2.3</velocity.version>
        <jwt.version>0.9.1</jwt.version>
        <okhttp3.version>4.8.1</okhttp3.version>
    </properties>


            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp</artifactId>
                <version>${okhttp3.version}</version>
            </dependency>

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
springboot集成minio的使用步骤如下: 1. 配置文件桶权限:可以在配置文件中设置minio的桶权限,包括读、写、删除等操作。可以根据具体需求进行配置。 2. 引入minio客户端依赖:在项目的pom.xml文件中添加minio客户端的依赖,以便在项目中使用minio的功能。 3. 配置文件修改:在项目的配置文件中添加minio的相关配置,包括minio服务器的地址、端口、用户名、密码等信息。 4. 定义minio配置类:创建一个配置类,用于将配置文件中的minio配置属性注入到该类中,方便后续使用。 5. 封装MinioClient:使用创建的minio配置类,创建一个MinioClient对象,用于与minio服务器进行交互。 6. HTTP接口实例:根据业务需求,编写相应的HTTP接口,使用MinioClient对象进行minio的相关操作,如上传文件、下载文件、创建桶等。 7. 总结:根据项目的具体情况,总结集成minio的使用体验和效果,并进行必要的优化和调整。 以上是springboot集成minio的基本步骤和流程,通过配置文件和代码的配合,可以实现对minio的灵活使用。可以根据具体的需求进行相应的扩展和定制。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [springboot集成minio客户端](https://blog.csdn.net/water1209/article/details/124241782)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [springboot集成Minio](https://blog.csdn.net/AYANBAO/article/details/130031830)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值