Last active
March 31, 2023 08:54
-
-
Save FrancescoJo/f1ed9534c7738e72c23cfbf4fc850575 to your computer and use it in GitHub Desktop.
How can we avoid DI error in this scenario without any annotations such as @primary, @qualifier, @resource?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Repository(UserReadonlyRepository.NAME) | |
interface UserReadonlyRepository { | |
suspend fun findById(userId: UUID): User? | |
companion object { | |
const val NAME = "a.b.c.UserReadonlyRepository" | |
} | |
} | |
@Repository(UserRepository.NAME) | |
interface UserRepository : UserReadonlyRepository { | |
suspend fun save(user: User): User | |
companion object { | |
const val NAME = "a.b.c.UserRepository" | |
} | |
} | |
@Bean | |
fun refundMyPurchaseHistoryUsecase( | |
@Qualifier(UserRepository.NAME) | |
users: UserRepository, | |
products: ProductRepository, | |
receipts: PurchaseReceiptRepository | |
) : ListMyPurchaseHistoryUsecase |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment