cat_dog_orange 2023-04-07 13:04 采纳率: 36.4%
浏览 26
已结题

使用android studio开发Spring Boot项目,报错

使用android studio开发Spring Boot项目,报错:Caused by: java.lang.ClassNotFoundException: org.springframework.web.reactive.config.WebFluxConfigurer。添加相关依赖:compile("org.springframework:spring-web-reactive:5.0.0.M1")后报错(如下),求大佬指导:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileJava'.
> Could not resolve all files for configuration ':app:compileClasspath'.
   > Could not find org.springframework:spring-web-reactive:5.0.0.M1.
     Required by:
         project :app

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

build.gradle(app)如下:

apply plugin: 'java'
apply plugin: 'org.springframework.boot'


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    compile('org.springframework.boot:spring-boot-starter-parent:2.3.4.RELEASE')
    compile('org.springframework.boot:spring-boot-starter-web:2.3.4.RELEASE')
    compile('com.aliyun.oss:aliyun-sdk-oss:3.15.0')
    compile('com.aliyun:aliyun-java-sdk-sts:3.0.0')
    compile('com.aliyun:aliyun-java-sdk-core:4.4.6')
    compile('org.projectlombok:lombok:1.16.10')
    compile('io.springfox:springfox-boot-starter:3.0.0')
    compile('org.springframework:spring-web:5.3.14')
    compile('org.springframework:spring-web-reactive:5.0.0.M1')
}

build.gradle(项目)如下:

buildscript {
    
    repositories {
        mavenLocal()
        mavenCentral()
        
    }
    dependencies {
        classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.9.RELEASE'
        

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
  • 写回答

2条回答 默认 最新

  • Leodong. 2023-04-07 13:36
    关注

    该回答通过自己思路及引用到GPTᴼᴾᴱᴺᴬᴵ搜索,得到内容具体如下:

    您的问题可能是由于Spring Boot版本与Spring Web Reactive版本不兼容导致的。
    在Spring Boot 2.3.4.RELEASE中,Spring Web Reactive的版本应该是5.2.x而不是5.0.0.M1。
    请尝试将依赖项中的Spring Web Reactive版本更改为5.2.x,并重新运行Gradle构建。
    
    以下是更改后的build.gradle(app)文件:
    
    apply plugin: 'java'
    apply plugin: 'org.springframework.boot'
     
     
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        compile('org.springframework.boot:spring-boot-starter-parent:2.3.4.RELEASE')
        compile('org.springframework.boot:spring-boot-starter-web:2.3.4.RELEASE')
        compile('com.aliyun.oss:aliyun-sdk-oss:3.15.0')
        compile('com.aliyun:aliyun-java-sdk-sts:3.0.0')
        compile('com.aliyun:aliyun-java-sdk-core:4.4.6')
        compile('org.projectlombok:lombok:1.16.10')
        compile('io.springfox:springfox-boot-starter:3.0.0')
        compile('org.springframework:spring-web:5.3.14')
        compile('org.springframework:spring-webflux:5.2.14.RELEASE')
    }
     
    build.gradle(项目)文件保持不变。
    
    如果您在更改依赖项版本后仍然遇到问题,请尝试在Gradle构建中添加--refresh-dependencies选项来刷新依赖项缓存,例如:
    
    ./gradlew clean build --refresh-dependencies
    
    希望这可以帮助您解决问题。
    

    如果以上回答对您有所帮助,点击一下采纳该答案~谢谢

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(1条)

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 4月10日
  • 已采纳回答 4月10日
  • 创建了问题 4月7日

悬赏问题

  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装
  • ¥40 复杂的限制性的商函数处理