I am having three classes A,B,C and connecting to database in each class with data source. Class 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();
}
Class B
public class B(){
@Autowired
private DataSource dataSourceB;
.../
dataSourceB.getConnection();
}
Class 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
|
|
└─────┘
But the above application throws a some of the beans in the application context form a cycle error which I do not why.Any help is appreciated