Details
-
Enhancement
-
Status: Closed
-
Should
-
Resolution: Fixed
-
FM2 1.0.0
-
None
-
None
-
Low
Description
Currently, the FHIR2 module has compatibility issues with other modules that utilize the HAPI libraries. Even modules that depend on just the HAPI client require excluding the hapi-fhir-base libraries that are bundled by default.
In addition, the FhirContext object is expensive to make, and re-using the FHIR module's FhirContext - for example with ctx = applicationContext.getBean(FhirContext.class); ctx = applicationContext.getBean(FhirContext.class); - is useful when FHIR funtionality is required in other modules. However, since the FHIR module does not currently include the HAPI client, the FhirContext cannot be used for this functionality out of the box.
Suggestion from
ibacher :
"I would actually rather just move all that logic into the FHIR module so that if you obtain one of the FHIR contexts created by the FHIR module, you get the client just by doing ctx.newRestfulGenericClient(). I also think we can simplify things somewhat by moving the configuration of the client factory into the Spring configuration. E.g., adding something like this to the FHIR module configuration:
<bean name="restfulClientFactoryR3" class="ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory">
<property name="fhirContext" ref="fhirR3"/>
</bean>
<bean name="restfulClientFactoryR4" class="ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory">
<property name="fhirContext" ref="fhirR4"/>
</bean>
<bean name="fhirR3" class="ca.uhn.fhir.context.FhirContext" factory-method="forDstu3">
<property name="restfulClientFactory" ref="restfulClientFactoryR3"/>
</bean>
<bean name="fhirR4" class="ca.uhn.fhir.context.FhirContext" factory-method="forR4">
<property name="restfulClientFactory" ref="restfulClientFactoryR4"/>
</bean>
We might even be able to not specify the restfulClientFactoryRX objects and just use HAPIs loading mechanism."