January 2019
Intermediate to advanced
490 pages
15h 37m
English
We will be improving the code we created in the Using AWS SDK, Amazon CloudWatch and AWS CLI with Lambda recipe. Before doing Dependency Injection, you need to refactor your code to follow the principle of programming to interfaces.
Refactor the service class into an interface and its implementation. I will also add lombok's @AllArgsConstructor annotation to generate an all args constructor, which will be used during unit testing to inject the mock object.
/** * Interface for IAM operations. */public interface IAMService {
We will define the corresponding implementation as IAMServiceImpl:
/** * Implementation of {@link IAMService}. */@AllArgsConstructorpublic class IAMServiceImpl ...
Read now
Unlock full access