sq-ch3-ex7 프로젝트에 순환 의존성 예가 있다. 다음 코드에 제시된 것처럼 Parrot 빈의 인스턴스를 생성할 때 Person 빈에 의존하도록 만들었고 그 반대도 동일하다. Person 클래스는 다음과 같다.
@Component
public class Person {
private final Parrot parrot;
@Autowired
public Person(Parrot parrot) { ← 스프링은 Person 인스턴스를 생성하는 데 Parrot 빈이 필요하다.
this.parrot = parrot;
}
// 코드 생략
}