Skip to content
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

Add Injector with Component #1021

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

katrusyavshch
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on implementing the dependency injection pattern and ensuring all components work seamlessly together! 🎉 While there are minor suggestions like checking the instances map before creating new instances and adding the @Target annotation to custom annotations, these do not impact the core functionality. Keep up the good work and consider these improvements for future projects! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨


@Retention(RetentionPolicy.RUNTIME)
public @interface Inject {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding the @Target annotation to specify where this annotation can be applied. According to the checklist, you should not forget to add @Target to custom annotations .


public static Injector getInjector() {
return injector;
}

public Object getInstance(Class<?> interfaceClazz) {
return null;
if (instances.containsKey(interfaceClazz)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the checklist, you should check the instances map before creating a new instance. This ensures that you are not unnecessarily creating new instances when an instance already exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants