首页 > 其他分享 >340_依赖循环引用Relying upon circular references is discouraged and they are prohibited by default

340_依赖循环引用Relying upon circular references is discouraged and they are prohibited by default

时间:2024-03-20 10:00:27浏览次数:18  
标签:21 default spring upon prohibited references main com circular

报错信息

image.png

15:21:53.398 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter - [report,40] - 

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

Description:

The dependencies of some of the beans in the application context form a cycle:

   tokenController (field private com.ruoyi.auth.service.SysLoginService com.ruoyi.auth.controller.TokenController.sysLoginService)
      ↓
   sysLoginService (field private com.ruoyi.system.api.RemoteLogService com.ruoyi.auth.service.SysLoginService.remoteLogService)
      ↓
   org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration
┌─────┐
|  com.alibaba.cloud.sentinel.SentinelWebAutoConfiguration (field private java.util.Optional com.alibaba.cloud.sentinel.SentinelWebAutoConfiguration.sentinelWebInterceptorOptional)
└─────┘

Action:

Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.

15:21:54.055 [Thread-3] WARN  c.a.n.c.h.HttpClientBeanHolder - [shutdown,108] - [HttpClientBeanHolder] Start destroying common HttpClient
15:21:54.056 [Thread-8] WARN  c.a.n.c.n.NotifyCenter - [shutdown,136] - [NotifyCenter] Start destroying Publisher
15:21:54.056 [Thread-8] WARN  c.a.n.c.n.NotifyCenter - [shutdown,153] - [NotifyCenter] Destruction of the end
15:21:54.056 [Thread-3] WARN  c.a.n.c.h.HttpClientBeanHolder - [shutdown,114] - [HttpClientBeanHolder] Destruction of the end
Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.

依赖循环引用是不鼓励的,默认情况下是禁止的。 更新应用程序以删除bean之间的依赖循环。 作为最后的手段,可以通过设置spring.main来自动打破循环。 allow-circular-references为true。  

解决

image.png

spring:
  main:
    allow-circular-references: true
# Tomcat
server: 
  port: 9200

# Spring
spring:
  application:
    # 应用名称
    name: ruoyi-auth
  profiles:
    # 环境配置
    active: dev
  cloud:
    nacos:
      discovery:
        # 服务注册地址
        server-addr: 172.16.0.246:8848
      config:
        # 配置中心地址
        server-addr: 172.16.0.246:8848
        # 配置文件格式
        file-extension: yml
        # 共享配置
        shared-configs:
          - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
  main:
    allow-circular-references: true

标签:21,default,spring,upon,prohibited,references,main,com,circular
From: https://www.cnblogs.com/wl3pb/p/18084575

相关文章

  • 解释nginx.conf.default 中关于fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_sc
    在nginx配置中,fastcgi_param指令用于定义传递给FastCGI服务器(如PHP-FPM)的参数。这些参数是FastCGI协议的一部分,用于在nginx和PHP-FPM之间传递关于请求的信息。在给出的配置片段中:nginxfastcgi_paramSCRIPT_FILENAME/scripts$fastcgi_script_name;这一行定义了一个FastCGI......
  • OpenMP - default子句
    OpenMP是基于共享内存编程模型的,这意味着除非明确指定,否则所有的变量在并行区域中都是共享的。使用default子句,程序员可以更改这种默认行为。default(none)指定在并行区域内,除非明确指定为shared或private,否则所有变量都是未定义的。这要求程序员显式地指定每个变量的作用域;defau......
  • MogDB-openGauss default privileges 使用方法
    MogDB/openGaussdefaultprivileges使用方法权限是用户访问数据库对象的首要条件,每个新增用户默认属于PUBLIC角色组成员,也就是具有PUBLIC角色组的权限,但在日常业务使用中,仅仅具有PUBLIC权限是远远不够的,还需要具有额外的权限,在MogDB/openGauss数据库支持的业务中经常需......
  • [GPT] export default {} 和 export {} 的区别
    在JavaScriptES6模块系统中,exportdefault{}和export{}有明显的区别: 1.exportdefault{}:这个语法用于导出一个默认的模块成员,它可以是一个对象、函数、类等。当导入时,可以使用任何名称来引用这个默认导出的成员,或者不指定名称直接导入。每个模块只能有一个exportdef......
  • [GPT] export, export default, import, module.exports, require
     ES6规范:export和import配对 import的{}大括号里面指定要从其他模块导入的变量名, 如果export命令没有写default,那么import{}大括号里面的变量名,必须与export导出的名称相同。  exportdefault为模块指定默认输出,这样在引入时就不必关心模块输出的名字。 本质......
  • 02-defaultdic类工作原理及应用实例(全网最全?含常值函数的创建)
    经常看到说“优雅地书写代码”,总是没啥感觉,直到这两天认真查阅了defaultdic这个类的一些资料。原来,灵活的应用,真的可以这么优雅、简单。1 简要描述defaultdic是collections包中的一个扩展类,是内置dict类的子类。这个类比较简单,除了重写了dict类的__miss__方法,增加了一个......
  • default在java中的用法 java里default
    介绍default是在java8中引入的关键字,也可称为Virtualextensionmethods——虚拟扩展方法。是指,在接口内部包含了一些默认的方法实现(也就是接口中可以包含方法体,这打破了Java之前版本对接口的语法限制),从而使得接口在进行扩展的时候,不会破坏与接口相关的实现类代码。为什么需要这......
  • Go 100 mistakes - #81: Using the default HTTP client and server
        ......
  • 报错真正的原因export ‘default’(imported as‘Vue’) was not found in‘vue
    运行npmrundev后报错:export'Vue'(importedas'Vue')wasnotfoundin'vue' 并且加载不出页面,查了很久,终于找到原因:报错信息:WARNINGin./src/index.js24:13-16export'Vue'(importedas'Vue')wasnotfoundin'vue'(p......
  • Python中字典setdefault()方法和append()的配合使用
    1.setdefault()方法语法dict.setdefault(key,default=None)说明:如果字典中包含给定的键值,那么返回该键对应的值。否则,则返回给定的默认值。Syntax:dict.setdefault(key,default_value)Parameters:Ittakestwoparameters:key–Keytobesearchedinthedictionar......