package net.safedata.springboot.training.d01.s04.service;

import net.safedata.springboot.training.d01.s04.repository.ProductRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
 * A simple product service, which uses a {@link ProductRepository} as a collaborator
 *
 * @author bogdan.solga
 */
@Service
public class ProductService {

    private final ProductRepository productRepository;

    @Autowired
    public ProductService(@Qualifier(value = "mySQLProductRepository") final ProductRepository productRepository) {
        this.productRepository = productRepository;
    }

    public void displayProducts() {
        productRepository.displayProducts();
    }
}

@@ -493,33 +493,99 @@
 oductRepository 
-p
+mySQLProductRepository;%0A    private final ProductRepository oracleP
 roductRepository
@@ -697,17 +697,143 @@
 ository 
-p
+mySQLProductRepository,%0A                          @Qualifier(value = %22oracleProductRepository%22) final ProductRepository oracleP
 roductRe
@@ -857,17 +857,22 @@
    this.
-p
+mySQLP
 roductRe
@@ -886,95 +886,286 @@
 y = 
-productRepository;%0A    %7D%0A%0A    public void displayProducts() %7B%0A        productRepository
+mySQLProductRepository;%0A        this.oracleProductRepository = oracleProductRepository;%0A    %7D%0A%0A    public void displayProducts() %7B%0A        final ProductRepository usedRepo = System.currentTimeMillis() %25 2 == 0 ? mySQLProductRepository : oracleProductRepository;%0A        usedRepo
 .dis

Use both service beans