FHIR icon indicating copy to clipboard operation
FHIR copied to clipboard

Use injectable services instead of singletons

Open punktilious opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. Services like FHIRRemoteIndexService currently are accessed using a static instance. The service is initialized in FHIRServletContextListener.

Describe the solution you'd like We should use a whiteboard pattern where services can be published rather than rely on a static instance variable. This reduces coupling and in general makes it easier to test (by making it easier to inject mocks etc).

Describe alternatives you've considered Keep the current pattern.

Acceptance Criteria

  1. GIVEN the refactor is implemented WHEN the code is built and the system integration tests are executed THEN the build succeeds and the system integration tests all pass.

Additional context N/A

punktilious avatar Jun 14 '22 11:06 punktilious

this sounds a lot like https://github.com/IBM/FHIR/issues/2687

lmsurpre avatar Jun 14 '22 14:06 lmsurpre