October 2017
Intermediate to advanced
396 pages
10h 2m
English
Here you can annotate the setter method's setAccountRepository and setTransferRepository with the @Autowired annotation. This annotation can be used with any method. There is no specific reason to use it with the setter method only. Please refer to the following code:
public class TransferServiceImpl implements TransferService {
//...
@Autowired
public void setAccountRepository(AccountRepository accountRepository) {
this.accountRepository = accountRepository;
}
@Autowired
public void setTransferRepository(TransferRepository transferRepository) {
this.transferRepository = transferRepository;
}
//...
}
Read now
Unlock full access