我有三个类A,B,C并使用数据源连接到每个类的数据库。 A类
public class A(){
@Autowired
private DataSource dataSourceA;
@Bean
@Primary
@ConfigurationProperties(prefix = "spring.ds")
public DataSource DataSourcePGStreet() {
return DataSourceBuilder.create().build();
}
.../code here
dataSourceA.getConnection();
}
B类
public class B(){
@Autowired
private DataSource dataSourceB;
.../
dataSourceB.getConnection();
}
C类
public class C(){
@Autowired
private DataSource dataSourceC;
.../code here
dataSourceC.getConnection();
}
***************************
APPLICATION FAILED TO START
***************************
Description:
The dependencies of some of the beans in the application context form a cycle:
| dataSourceA
|
dataSourceB
|
dataSourceC
|
|
└─────┘
但是上面的应用程序会在应用程序上下文中抛出一些bean形成一个循环错误,我不知道为什么。感谢任何帮助