public interface TestService { public String test(); }
@Service public class TestServiceImpl implements TestService{ @Override public String test() { return "TestServiceImpl"; } }
@RestController public class TestCtl { @Autowired private TestService testService; @RequestMapping("/test") public String test() { return testService.test(); } }
@Service public class TestServiceImpl2 implements TestService{ @Override public String test() { return "TestServiceImpl2"; } }
@Autowired @Qualifier("testServiceImpl") private TestService testService;
@Resource(name = "testServiceImpl") private TestService testService;
@Resource private TestService testServiceImpl;
@Service @Primary public class TestServiceImpl2 implements TestService{ @Override public String test() { return "TestServiceImpl2"; } }