I need to create and/or validate a small number of resources as a part of the bootup process of a HAPI FHIR (JPA) server. I went hunting for a server hook that I could use for this purpose - the goal is that before I see “a FHIR has been lit on this server” in the log, this custom initialization has also been completed.
So I found the initialize() method in the RestfulServer class, and the “add your own” in the JpaRestfulServer subclass. I added my code and tried it out … but that didn’t work.
I looked at the source code for RestfulServer and found that the initialize() method is called BEFORE the providers are initialized, so clearly - I can’t use a DAO to access resources there.
Where possible I like to use existing hooks / override method, etc. to do this kind of thing. I really don’t want to change base classes or “core” infrastructure. it would be nice if initialize() was called AFTER the providers were initialized.
Can anybody suggest a clean method to do what I want, which is to do some startup maintenance of a handful of special resources before the server goes live?
Thanks,
Mark