Skip to content

Commit

Permalink
refactor: qualifier 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
mirageoasis committed Aug 22, 2024
1 parent 5ce7cd6 commit 0b75e47
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.thirdparty.ticketing.global.config;

import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
Expand All @@ -22,29 +23,33 @@ public class ReservationServiceContainer {
@Bean
public ReservationService redissonReservationServiceProxy(
RedissonClient redissonClient,
ReservationTransactionService cacheReservationTransactionService) {
@Qualifier("cacheReservationTransactionService")
ReservationTransactionService cacheReservationTransactionService) {
return new RedissonReservationServiceProxy(
redissonClient, cacheReservationTransactionService);
}

@Bean
public ReservationService lettuceReservationServiceProxy(
LettuceRepository lettuceRepository,
ReservationTransactionService cacheReservationTransactionService) {
@Qualifier("cacheReservationTransactionService")
ReservationTransactionService cacheReservationTransactionService) {
return new LettuceReservationServiceProxy(
lettuceRepository, cacheReservationTransactionService);
}

@Primary
@Bean
ReservationService optimisticReservationServiceProxy(
ReservationTransactionService persistenceOptimisticReservationService) {
@Qualifier("persistenceOptimisticReservationService")
ReservationTransactionService persistenceOptimisticReservationService) {
return new OptimisticReservationServiceProxy(persistenceOptimisticReservationService);
}

@Bean
ReservationService pessimisticReservationServiceProxy(
ReservationTransactionService persistencePessimisticReservationService) {
@Qualifier("persistencePessimisticReservationService")
ReservationTransactionService persistencePessimisticReservationService) {
return new PessimisticReservationServiceProxy(persistencePessimisticReservationService);
}

Expand Down

0 comments on commit 0b75e47

Please sign in to comment.