java: 无法访问org.springframework.web.bind.annotation.RequestMapping......类文件具有错误的版本 61.0, 应为 52.0

02-27 阅读 0评论

文章目录

  • 一、报错问题
  • 二、问题背景
  • 三、原因分析
  • 四、解决方案

    一、报错问题

    java: 无法访问org.springframework.web.bind.annotation.RequestMapping 错误的类文件: /D:/SoftwareInstall/Maven/repository/org/springframework/spring-web/6.0.9/spring-web-6.0.9.jar!/org/springframework/web/bind/annotation/RequestMapping.class 类文件具有错误的版本 61.0, 应为 52.0 请删除该文件或确保该文件位于正确的类路径子目录中。

    java: 无法访问org.springframework.web.bind.annotation.RequestMapping......类文件具有错误的版本 61.0, 应为 52.0

    二、问题背景

    版本信息:spring boot:3.1.0,jdk:1.8

    pom.xml

        
            org.springframework.boot
            spring-boot-starter-parent
            3.1.0
             
        
        com.example
        first-spring-boot-project
        0.0.1-SNAPSHOT
        first-spring-boot-project
        first-spring-boot-project
        
            1.8
        
    

    三、原因分析

    SpringBoot使用了3.0或者3.0以上,因为Spring官方发布从Spring6以及SprinBoot3.0开始最低支持JDK17,所以仅需将SpringBoot版本降低为3.0以下即可(或者将JDK版本升级为17及以上)。

    Spring Boot 3.0 最低要求 Java 17,并向上兼容支持 Java 19。

    四、解决方案

    方案1:升级JDK版本,将JDK版本升级为JDK17及以上版本。如下所示。

    java: 无法访问org.springframework.web.bind.annotation.RequestMapping......类文件具有错误的版本 61.0, 应为 52.0,java: 无法访问org.springframework.web.bind.annotation.RequestMapping......类文件具有错误的版本 61.0, 应为 52.0,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,使用,访问,解决方案,第3张
    (图片来源网络,侵删)

    pom.xml

        
            org.springframework.boot
            spring-boot-starter-parent
            3.1.0
             
        
        com.example
        first-spring-boot-project
        0.0.1-SNAPSHOT
        first-spring-boot-project
        first-spring-boot-project
        
            17
        
    

    方案2:降低SpringBoot版本,将SpringBoot版本降低为3.0以下。如下所示。

    pom.xml

        
            org.springframework.boot
            spring-boot-starter-parent
            2.7.6
             
        
        com.example
        first-spring-boot-project
        0.0.1-SNAPSHOT
        first-spring-boot-project
        first-spring-boot-project
        
            1.8
        
    
    java: 无法访问org.springframework.web.bind.annotation.RequestMapping......类文件具有错误的版本 61.0, 应为 52.0,java: 无法访问org.springframework.web.bind.annotation.RequestMapping......类文件具有错误的版本 61.0, 应为 52.0,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,使用,访问,解决方案,第4张
    (图片来源网络,侵删)

免责声明
本网站所收集的部分公开资料来源于AI生成和互联网,转载的目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。
文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

发表评论

快捷回复: 表情:
评论列表 (暂无评论,人围观)

还没有评论,来说两句吧...

目录[+]