• The attempt was made from the following location: com.ruoyi.framework.config.ResourcesConfig.corsFilter(ResourcesConfig.java:57)


    报错信息:

    8:42:12.529 [restartedMain] ERROR o.s.b.w.e.t.TomcatStarter - [onStartup,61] - Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'corsFilter' defined in class path resource [com/ruoyi/framework/config/ResourcesConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.filter.CorsFilter]: Factory method 'corsFilter' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.cors.CorsConfiguration.addAllowedOriginPattern(Ljava/lang/String;)V
    18:42:12.597 [restartedMain] ERROR o.s.b.d.LoggingFailureAnalysisReporter - [report,40] - 
    
    ***************************
    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:
    
        com.ruoyi.framework.config.ResourcesConfig.corsFilter(ResourcesConfig.java:57)
    
    The following method did not exist:
    
        org.springframework.web.cors.CorsConfiguration.addAllowedOriginPattern(Ljava/lang/String;)V
    
    The method's class, org.springframework.web.cors.CorsConfiguration, is available from the following locations:
    
        jar:file:/D:/z_GreenTools/repository/org/springframework/spring-web/5.2.12.RELEASE/spring-web-5.2.12.RELEASE.jar!/org/springframework/web/cors/CorsConfiguration.class
    
    It was loaded from the following location:
    
        file:/D:/z_GreenTools/repository/org/springframework/spring-web/5.2.12.RELEASE/spring-web-5.2.12.RELEASE.jar
    

    解决方法:

    • 找到如图路径:修改方法:config.addAllowedOriginPattern("*");

    • 修改为:config.addAllowedOrigin("*");

  • 相关阅读:
    cpp学习
    7-2 求逆序对数目 (20分) 归并排序 O(nlogn)
    Egret 滚动背景图的实现
    Egret-我的疑问:Scroller如何禁止水平或垂直方向滚动
    Egret-我的探索:exml自定义组件中通过ID获取子组件实例
    Egret-我的疑问:自定义组件加载skin的操作
    Egret事件冒泡的应用
    Egret点击穿透(使遮盖可点击组件的其他组件禁止点击)
    Egret wing 4.1.6项目目录结构
    Egret分步加载资源改写loading界面
  • 原文地址:https://www.cnblogs.com/liuyangfirst/p/16166903.html
Copyright © 2020-2023  润新知