介绍
在写业务时,调试出现Spring循环依赖报错,运行不了。
bash
The dependencies of some of the beans in the application context form a cycle:
authUserController
┌─────┐
| authUserService
↑ ↓
| loginTypeHandlerFactory
↑ ↓
| loginByEmail
└─────┘
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.解决
总结
Java内存模型是一种抽象的概念,它描述了程序中各个变量之间的关系以及在计算机系统中将变量存储到内存和从内存中取出变量的底层细节。 它的存在主要是为了屏蔽不同硬件和操作系统之间的差异,使得Java程序能够在不同的平台上达到一致的内存访问结果。
