jeudi 26 janvier 2017

Circular dependency in Spring injection - Is this bad design?

I am stuck with following issue :

I am trying to create beans as follows:

@Bean
public abc createABC() {
    return new ABC(--, def(),--);
}

`

@Bean
public DEF def() {
    return new DEF(--, createABC(),--
}

Any suggestions to get around this problem without chaging to setter based injection. Is it the indicative of bad design? In my situation this dependency is must. Please provide your viewpoints on this

Aucun commentaire:

Enregistrer un commentaire