-
Notifications
You must be signed in to change notification settings - Fork 998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Injector #705
base: main
Are you sure you want to change the base?
Implement Injector #705
Conversation
Update Component and Injector annotation Retention policy and set Target element type
private Injector() { | ||
instances = new HashMap<>(); | ||
implementations = Map.of(FileReaderService.class, FileReaderServiceImpl.class, | ||
ProductParser.class, ProductParserImpl.class, | ||
ProductService.class, ProductServiceImpl.class); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant
if (injector == null) { | ||
injector = new Injector(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant
if (!componentClass.isAnnotationPresent(Component.class)) { | ||
throw new RuntimeException("Can't get instance of non-component class " | ||
+ interfaceClazz.getName()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move it to separate method
Update Component and Injector annotation Retention policy and set Target element type