Stream: hapi
Topic: HAPI spring boot customizer problem
Lars Rückert (Jan 24 2019 at 13:42):
Hello,
I have a question regarding the usage of HAPI with spring-boot.
I created a hapi fhir server for dstu3 based on what I gathered from the hapi-fhir-spring-boot examples and adjusted to my needs.
However, spring-boot is a whole lot of magic for me and I don't quite understand what is happening in what order.
My problem specifically is that I adjust my server using something like this:
@Configuration public class MyFhirServerCustomizer implements FhirRestfulServerCustomizer { public void customize(RestfulServer server) { ... server.registerProvider(new MyPlainProvider(server)); } @Bean public DaoConfig daoConfig() { ... } }
In my customizer I register a plain provider that I wrote, with some operation I need.
The defined customizers are called by the class FhirAutoConfiguration
But after my customizer is called, another customizer is called, that is defined in the same file on line 185, which overrides my plain provider:
@Configuration @ConditionalOnBean({DaoConfig.class, RestfulServer.class}) @SuppressWarnings("rawtypes") static class RestfulServerCustomizer implements FhirRestfulServerCustomizer { private final BaseJpaSystemProvider systemProviders; public RestfulServerCustomizer(ObjectProvider<BaseJpaSystemProvider> systemProviders) { this.systemProviders = systemProviders.getIfAvailable(); } @Override public void customize(RestfulServer server) { server.setPlainProviders(systemProviders); } }
I have the FhirAutoConfiguration included as a dependency via pom.xml and can't change the code in it.
How can I achieve that my own plain providers are registered once the server is running?
The customizers are being sorted before execution and I already tried an @Order
annotation on the MyFhirServerCustomizer
, but neither highest nor lowest order did the trick.
I hope I demonstrated my problem clearly enough.
Thanks,
Lars
Last updated: Apr 12 2022 at 19:14 UTC