rhakdnj / kopring

0 stars 0 forks source link

@Primary VS @Qualifier #2

Open rhakdnj opened 8 months ago

rhakdnj commented 8 months ago
@Component @Primary
class QuickSort implement SortingAlgorithm

@Component
class BubbleSort implement SortingAlgorithm 

@Component @Qualifier("RadixSortQualifier")
class RadixSort implement SortingAlgorithm 

@Component
class ComplexAlgorithm(
  algorithm: SortingAlgorithm, // @Primary
) 

@Component
class AnotherComplexAlgorithm(
  // @Qualifier
  @Qualifier("RadixSortQualifier") algorithm: SortingAlgorithm,
) 

우선 순위

@Qualifier > @Primary