October 2017
Intermediate to advanced
396 pages
10h 2m
English
Here you can annotate those class properties which are required for this class to achieve a business goal. Let's see the following code:
public class TransferServiceImpl implements TransferService {
@Autowired
AccountRepository accountRepository;
@Autowired
TransferRepository transferRepository;
//...
}
In the preceding code, the @Autowired annotation resolves the dependency by type and then by name if the property name is the same as the bean name in the Spring container. By default, the @Autowired dependency is a required dependency--it raises an exception if the dependency is not resolved, it doesn't matter whether we have used it with a constructor or with the setter method. You can override the required ...
Read now
Unlock full access