lundi 5 juin 2023

Service Class with Multiple Repositories

class AccountClosureService(
    private val accountClosureRepository: AccountClosureRepository,
    private val userApplicationRepository: UserApplicationRepository,
){ 
// CRUD METHODS 
}

interface AccountClosureRepository{}

@Component
private class AccountClosureRepositoryImpl(): AccountClosureRepository
{}


interface UserApplicationRepository{}

@Component
private class UserApplicationRepositoryImpl():UserApplicationRepository
{}

I doesn't look fine to inject UserApplicationRepository in AccountClosureService as both Entities is different.

Not sure if we have a better way to implement above Class Design.

Checked RepositoryDesignPattern but no solution found for this case.

Any suggestions would be appreciated !!

Aucun commentaire:

Enregistrer un commentaire