Skip to content

Commit 259f3ca

Browse files
Create CircularDependencyA
1 parent 9257da4 commit 259f3ca

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.baeldung.circulardependency;
2+
3+
import org.springframework.beans.BeansException;
4+
import org.springframework.beans.factory.InitializingBean;
5+
import org.springframework.context.ApplicationContext;
6+
import org.springframework.context.ApplicationContextAware;
7+
import org.springframework.stereotype.Component;
8+
9+
@Component
10+
public class CircularDependencyA implements ApplicationContextAware, InitializingBean {
11+
12+
private CircularDependencyB circB;
13+
14+
private ApplicationContext context;
15+
16+
public CircularDependencyB getCircB() {
17+
return circB;
18+
}
19+
20+
@Override
21+
public void afterPropertiesSet() throws Exception {
22+
circB = context.getBean(CircularDependencyB.class);
23+
}
24+
25+
@Override
26+
public void setApplicationContext(final ApplicationContext ctx) throws BeansException {
27+
context = ctx;
28+
}
29+
}

0 commit comments

Comments
 (0)