I do not really understand the difference. You just need to create two different beans in this case, and then annotate them with @Qualifier.
, :
@RestController
@RequestMapping("/account")
public class AccountManagerRestController {
@Autowired
@Qualifier("DefaultAccountServiceImpl")
private AccountService serviceDAS;
@Autowired
@Qualifier("SpecializedAccountServiceImpl")
private AccountService serviceSAS;
@RequestMapping(value = "/register", method = RequestMethod.POST)
HttpEntity<?> registerAccount(@RequestBody AccountRegisterRequestBody input) {
...
}
@RequestMapping(value = "/register/specialized", method = RequestMethod.POST)
HttpEntity<?> registerSpecializedAccount(@RequestBody AccountRegisterRequestBody input) {
...
}
}
@Resource :
@Resource(name = "DefaultAccountServiceImpl")
private AccountService serviceDAS;
@Resource(name = "SpecializedAccountServiceImpl")
private AccountService serviceSAS;
, .