I have 3 Service classes in my application each written for specific functionalities with respective DAO interfaces & their implementation classes. All services have different packages.
Say I have
AService.java & ADAO.java
ADAO interface is injected into AService.java class. Similarly I have
BService.java & BDAO.java
CService.java & CDAO.java
Now I want to refer some methods of BDAO & CDAO implementation classes in AService.java
What should be the best way to do that?
-
I inject BDAO & CDAO in AService.java. Would that be a good practice? Services are tightly coupled in this scenario.
-
I write the redundant code in respective DAOs.
-
I create a generic DAO & try to extract all the common methods from all the individual DAOs & put into that. This is an extensive task. Also I am not sure in future which method of which DAO will be required in which particular service.
Aucun commentaire:
Enregistrer un commentaire