-
Notifications
You must be signed in to change notification settings - Fork 6
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
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java
Show resolved
Hide resolved
shared/src/main/java/gov/hhs/cdc/trustedintermediary/external/hapi/HapiFhirResource.java
Outdated
Show resolved
Hide resolved
PR Code Suggestions ✨Explore these optional code suggestions:
|
…singleton-class' into use-inject-for-non-singleton-class
...rc/testFixtures/groovy/gov/hhs/cdc/trustedintermediary/context/TestApplicationContext.groovy
Outdated
Show resolved
Hide resolved
...rc/testFixtures/groovy/gov/hhs/cdc/trustedintermediary/context/TestApplicationContext.groovy
Outdated
Show resolved
Hide resolved
Remove unreachable if statement
Add additional line in coverage
Remove parameter from injectRegisteredImplementations
Added test case for unsupported injection classes
…ble_code Application context fix unreachable code
…om/CDCgov/trusted-intermediary into use-inject-for-non-singleton-class
Print an error message if the class implementation is not found
shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java
Outdated
Show resolved
Hide resolved
shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java
Show resolved
Hide resolved
shared/src/main/java/gov/hhs/cdc/trustedintermediary/external/hapi/HapiFhirResource.java
Outdated
Show resolved
Hide resolved
...ed/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/hapi/HapiFhirResourceTest.groovy
Outdated
Show resolved
Hide resolved
shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/context/ApplicationContextTest.groovy
Outdated
Show resolved
Hide resolved
in HapiFhirResource and deleted file HapifhirResourceTest.groovy
Quality Gate passedIssues Measures |
* comment to start branch * getFieldsAnnotatedWithInstance helper method * todo comment deleted * injectIntoField overloaded method * injectIntoNonSingleton * access modifier protected to public * revert access modifier change * changes: added logger to HapiFhirResource in order to test a non-singleton class created HapiFhirResourceTest in order to test the changes to HapiFhirResource * Added implementors unit test to ApplicationContextTest * Minor refactoring on some AppContext injection methods * Make the skip flag on TestApplicationContext switchable from the test classes * Update ApplicationContext.java Remove unreachable if statement * Update TestApplicationContext.groovy Add additional line in coverage * Update TestApplicationContext.groovy Remove parameter from injectRegisteredImplementations * added unit tests to cover new code * Update ApplicationContextTest.groovy Added test case for unsupported injection classes * Update ApplicationContext.java Print an error message if the class implementation is not found * use return instead of System.err * refactoring - dry * thown(NullPointerException) -> noExceptionThrown() * added comments to indicate changes that will be deleted * deleted commented out code * reinstated comments for test case * deleted test changes: in HapiFhirResource and deleted file HapifhirResourceTest.groovy --------- Co-authored-by: Luis Pabon <turkeyfried@gmail.com> Co-authored-by: Luis Pabon <luis.pabon@agile6.com>
Description
This PR adds the logic necessary for non-singleton classes to use the @Inject annotation.
Changes
ApplicationContext.java
skipMissingImplementation
logicinjectRegisteredImplementations
->doInjectRegisteredImplementations
injectIntoField
methodinjectIntoNonSingleton()
methodReflections.java
getFieldsAnnotatedWithInstance
ApplicationContextText.groovy
TestApplicationContext.java
skipMissingImplementation
logicHapiFhirResource
HapiFhirResourceTest
Testing
ApplicationContext.injectIntoNonSingleton()
, using the constructorIssue
#1361
Checklist
Note: You may remove items that are not applicable