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

@Inject for Non-Singleton Classes #1361

Open
jorg3lopez opened this issue Sep 25, 2024 · 1 comment
Open

@Inject for Non-Singleton Classes #1361

jorg3lopez opened this issue Sep 25, 2024 · 1 comment
Assignees
Labels
devex/opex A development excellence or operational excellence backlog item. Stream 2

Comments

@jorg3lopez
Copy link
Contributor

Situation:

At the moment, we use the @Inject annotation for only singleton classes. This is because the ApplicationContext class only registers singleton classes. These classes are later scanned and have the instances injected, of the objects that use the @Inject annotation.

Proposed Solution:

Have the non-singleton classes be able to use the @Inject annotation to inject the instances of classes that have been registered into the ApplicationContext.

Reference:

https://flexion.slack.com/archives/C055XTF22B0/p1688582573819939

Food for Thought:

Create a method in the ApplicationContext that will take in the non-singleton object that has the @Inject annotations. This should be part of the constructor of the non-singleton objecct. It should call the method in the ApplicationContext and pass itself as the parameter.
The ApplicationContext will scan this class and inject the instances for the objects using @Inject.
This is an example of how it can be accomplished.

@jorg3lopez jorg3lopez added the devex/opex A development excellence or operational excellence backlog item. label Sep 25, 2024
@jorg3lopez jorg3lopez self-assigned this Sep 25, 2024
@jorg3lopez
Copy link
Contributor Author

Draft RP created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devex/opex A development excellence or operational excellence backlog item. Stream 2
Projects
None yet
Development

No branches or pull requests

2 participants