-
Notifications
You must be signed in to change notification settings - Fork 5
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
Use inject for non singleton class #1617
base: main
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
try { | ||
field.set(instance, fieldImplementation); | ||
} catch (IllegalAccessException | IllegalArgumentException exception) { | ||
throw new IllegalArgumentException( |
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.
Consider adding specific exception handling for different types of injection failures. This could improve the robustness and security of the application by providing clearer error messages and handling specific cases differently. [important]
private final IBaseResource innerResource; | ||
|
||
public HapiFhirResource(IBaseResource innerResource) { | ||
ApplicationContext.injectIntoNonSingleton(this); |
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.
To avoid potential issues with circular dependencies and incomplete construction, consider using a factory or builder pattern to manage object creation and dependency injection, rather than injecting dependencies directly in the constructor. [important]
PR Code Suggestions ✨Explore these optional code suggestions:
|
…singleton-class' into use-inject-for-non-singleton-class
Quality Gate passedIssues Measures |
Description
Under construction
Issue
Add a link to the issue here. Consider using
closing keywords
if the this PR isn't for a story (stories will be closed through different means).
Checklist
Note: You may remove items that are not applicable