vendredi 6 décembre 2019

Is it a good practice to make one Spring bean inherit another one?

In my Spring Boot web application there are two beans, one of them inherits other one and both implements an interface. Something line this:

@Component 
public class A implements SomeInterface {
    // ....
} 

@Component 
public class B extends A implements SomeInterface {
    // ....
} 

Is it a good idea to make one bean extending another one or it's better use a decorator? And why?

I don't mean any specific case but general one.

Aucun commentaire:

Enregistrer un commentaire