Spring boot:循环依赖(The dependencies of some of the beans in the application context form a cycle)

Notes (I forgot to take a screenshot of this question): The running process prompts that (the dependencies of some beans in the application context form a cycle)

The following description appears:

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

   todoController (field private com.xm.service.TodoService com.xm.controller.TodoController.todoService)
┌─────┐
|  todoService (field private com.xm.service.TodoService 

com.xm.service.TodoService.todoMapper)

Note: It will provide a processing method ( 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.

 Dependency circular references are not supported and are disabled by default, which can be set in the configuration file ( application.yml )

spring.main.allow-circular-references: true

As shown in the picture:

Guess you like

Origin blog.csdn.net/qq_47229902/article/details/123639801