I've never liked having to write individual setter methods for every class member to accomodate 2-stage construction. It appears this is no longer necessary w/ JavaConfig, unless I misunderstand. Can I use a single init method for 2nd stage c-tion as below w/o causing circular dependency exceptions?
@Configuration
public class AppConfig {
@Bean
public Clock clock() {
Clock clock = new Clock();
clock.init(ruler(), mind());
return clock;
}
@Bean
public Ruler ruler() {
Ruler ruler = new Ruler();
ruler.init(clock(), mind());
return ruler;
}
@Bean
public Mind mind() {
Mind mind = new Mind();
mind.init(ruler(), clock());
return mind;
}
}


