How to configure HAPI FHIR JPA starter with application.yaml
A team that has chosen the HAPI FHIR JPA starter must decide how its settings reach the server in each environment, and which of them must change before anything holds real patient data. Start by treating the starter's configuration as a deliberate, versioned input rather than a set of defaults: the database, the FHIR version, the enabled modules and the public address all have to be set on purpose for each environment, and the same server image should run unchanged across development, test and production with only those inputs differing.
HAPI FHIR is a Java API for HL7 FHIR clients and servers, licensed under the Apache Software License 2.0. The JPA server built on it provides a complete RESTful FHIR server backed by a database, using the JPA API rather than a specific database technology. Its documentation covers FHIR DSTU2, DSTU3, R4, R4B and R5. The starter, which packages that server for common deployment routes, defaults to an embedded H2 database. H2 is suitable for trying the server out, but production use needs PostgreSQL or Microsoft SQL Server, and MySQL is not supported. Confirm the database and FHIR version you intend to run against the starter's own documentation before you write the first configuration file.
Deliberate configuration matters most in three places: the datasource and its credentials, the FHIR version and any modules that change what the server stores or exposes, and the server's public base address, which determines the links it returns to clients. Keep secrets such as database passwords out of the YAML file itself and supply them through environment variables or a mounted secret. Review the hapi-fhir-jpaserver-starter repository for the exact configuration keys in your chosen release, and record the effective values for each environment so that a later upgrade or audit can show what was running.
Where configuration values come from in each deployment
The published hapiproject/hapi image ships with a default configuration baked in. You can supply your own configuration in two ways: mount an application.yaml file into the container at the location the image expects, or pass individual settings as environment variables when you start the container. Environment variables are applied on top of the YAML values, so a variable wins over the same key in the file. Confirm the mount path and the variable naming convention against the starter repository for the image tag you run, because these can change between versions.
- Mounted file: Bind or volume-mount your
application.yamlover the default path so the container reads your copy instead of the built-in one. - Environment overrides: Pass settings with
-eor theenvironmentblock. Relaxed binding maps names such asSPRING_DATASOURCE_URLto the matching property. - Precedence check: If a value does not apply, look for an environment variable that overrides it before editing the file.
- Image tag: Confirm the defaults and key names for the exact tag you pin, not for the latest tag.
- Startup logs: Review the logs after start to confirm which datasource and FHIR version were loaded.
After startup, confirm the effective values from the logs and the capability statement rather than assuming the file was read.
Compose adds a second layer of configuration: the environment block and env_file entries in the Compose file, plus any bind mount of a YAML file into the service. Values in the Compose file are passed into the container, so they behave like the same environment overrides used with plain Docker, but they are easier to lose track of when several files are involved. Keep one clear source for each key and document it, because a value set in an .env file, the Compose file and the mounted YAML can all disagree.
- Service environment: Define database and server settings under the service's
environmentkey, which takes precedence over values in the mounted file. - Env files: Use
env_filefor secrets kept out of the Compose file, and confirm that the file is not committed to version control. - Database host name: The datasource URL must use the Compose service name of PostgreSQL, not
localhost, which is a common reason a value appears to be ignored. - Variable substitution: Compose substitutes
${VAR}values from the shell or.envfile at parse time, so an empty variable can silently produce an empty setting. - Restart after change: Recreate the container after editing the YAML or Compose file, since a plain restart may not reload a changed mount.
Run docker compose config to view the resolved configuration before starting, and check the container's effective values after the first start.
When you run the starter as a Spring Boot application, the application reads application.yaml from the classpath or from a file location you provide. Spring Boot's externalized configuration rules then apply: properties from the command line, environment variables, and external files override values packaged inside the JAR. This makes the JAR portable across environments, but it also means a value set in the packaged file may be overridden by a source you did not expect. Identify the active profile and the file location before you change anything.
- External file: Point the application at a file outside the JAR with the Spring config location setting so the packaged defaults are not edited.
- Profiles: Profile-specific files apply only when the profile is active, so confirm which profile your start command activates.
- Command-line arguments: Arguments passed at launch have higher precedence than both files and environment variables.
- Environment variables: Use the relaxed naming convention from the Spring Boot documentation, and confirm the mapping for the starter version in use.
- Property source report: Use the actuator environment view, if exposed and secured, to see which source supplied each value.
Before go-live, confirm that the effective FHIR version, enabled modules and datasource settings match the intended production values.
Running ROOT.war in an existing application server moves configuration into that server's own mechanisms. The application still reads its settings through the servlet container, so the YAML file must be placed where the deployed application can find it, or the values must be supplied through JVM system properties or environment variables set on the server process. Many hospital environments control these locations tightly, so agree the approach with the server administrators before the first deployment. Exact file locations and override names depend on the starter version, so confirm them in the starter repository.
- File placement: Place the YAML file in a location the application loads at startup, and confirm that location for the WAR version you build.
- Server-level variables: Set environment variables or JVM options in the service definition, such as the Tomcat
setenvscript or the Jetty and Wildfly startup configuration. - Context path: Confirm the context path, since it affects the public base URL and must match the proxy configuration.
- Restart requirement: Most server-level values need a full application server restart, not only a redeploy.
- Secret handling: Avoid placing database passwords in files readable by all server users.
Check the effective values from the startup log and from a test request to confirm the server read the intended configuration.
The Helm chart generates the deployment and renders configuration from chart values, typically into a ConfigMap for the YAML and into environment variables or a Secret for sensitive settings. Your values file or --set arguments change what is rendered, so the chart values are the usual place to change behavior, not the rendered ConfigMap. Confirm how the chart exposes each setting, since chart keys do not always match the starter's YAML keys one to one. Check the chart version against the starter version you intend to run.
- Chart values: Set configuration in a version-controlled values file and review the rendered output with
helm templatebefore applying. - ConfigMap and Secret: Non-sensitive settings usually land in a ConfigMap, and passwords should come from a Secret, not plain values.
- Pod restarts: Changing a ConfigMap does not always restart pods, so confirm the rollout behavior for each change.
- Precedence: Extra environment variables in the pod spec can override rendered values, so review the full deployment spec.
- Chart version pinning: Pin the chart version and confirm the key names in its documentation for that version.
After each upgrade of the chart, compare the rendered configuration against the previous release to catch renamed or dropped keys.
Which configuration areas to set and when each fits
This table compares the main configuration areas of the JPA starter against the default settings and shows when each default is acceptable and when a production team should change it. Read each row as a checkpoint: confirm the exact keys in the starter's configuration reference before editing any file.
| Configuration area | Default or demo posture | When a production team should change it |
|---|---|---|
| FHIR version and server base settings | Starter ships with a FHIR version and a local base address suited to testing. | Set the FHIR version to match the clients and implementation guides you support, and set the public base address so Bundle links and references resolve correctly behind any proxy. |
| Database connection | Embedded H2 database, which is fine for local trials and throwaway environments. | Point the server at PostgreSQL or Microsoft SQL Server with a managed credential. MySQL is not supported, so do not plan around it. |
| Enabled modules (terminology, validation, MDM, partitioning) | Only the modules you turn on are active, so the server stays lighter with features off. | Enable terminology, validation, MDM or partitioning only when a requirement needs them, and load their data and schema changes as a planned step. Each module changes what the database and startup must handle. |
| Security interceptors and authorization | Authentication and authorization are not enforced by a single built-in layer, so the server is only as protected as the interceptors you wire in. | Before go-live, add authentication, the AuthorizationInterceptor and any consent or search narrowing rules your policy requires. Test that unauthorized requests fail with the expected responses. |
| CORS and browser access | Permissive settings suit local development with a browser front end on another origin. | Restrict allowed origins, methods and headers to the applications that really need them, and confirm that required headers such as ETag are exposed to browser clients. |
| Logging and audit | Default log levels suit debugging and show detailed output that may include request content. | Set log levels for production, keep request payloads out of routine logs, and add BALP audit logging where your audit obligations require it. Confirm retention with your compliance team. |
Layered files and overrides that cause go-live surprises
The starter reads configuration from several places at once: the packaged defaults, a mounted application.yaml, environment variables and, on Kubernetes, chart values. Most go-live surprises come from one of these layers quietly winning over another, so the effective configuration can differ from what the file in your repository says.
Mounted YAML shadowed by environment variables
Symptom: the server ignores a setting you changed in the mounted file. Cause: environment variables use Spring Boot's relaxed binding and generally take precedence over values in application.yaml, so an old variable left in the container spec wins silently. Check: list the effective environment of the running container and compare each key with the YAML file, then confirm the value the server reports at startup. Treat any key present in both places as a conflict to resolve.
Starter repositoryDefault H2 database left in place
Symptom: the server starts and serves data, but the data disappears after a container restart or the database never appears in your PostgreSQL or SQL Server monitoring. Cause: the starter defaults to an embedded H2 database, so if the datasource keys are not set in the final configuration, the server falls back to H2. Check: confirm the datasource URL, driver and credentials in the effective configuration, and verify that the database receives connections and that the data survives a restart in a test environment.
Starter database notesFHIR version or module differs by environment
Symptom: a resource type, operation or terminology feature works in staging and returns errors in production. Cause: the FHIR version and enabled modules are set in layered files, and a value enabled in one environment's override is missing from another, so the two servers expose different capabilities. Check: compare the capability statement from each environment and diff the enabled settings across environment files. Confirm the FHIR version matches the version your clients and implementation guides expect before go-live.
JPA server docsSecrets stored in the YAML file
Symptom: database passwords or client secrets appear in a Git repository, a ConfigMap or a copied image layer. Cause: teams put credentials directly in application.yaml because it is the easiest place to set them, then mount or bake that file into images that many people can read. Check: search the repository, image history and cluster ConfigMaps for password and secret keys, move credentials into environment variables sourced from your secret store, and rotate any value that was exposed.
Drift between Helm values and container configuration
Symptom: a setting changed through a Helm upgrade does not take effect, or a container restart reverts a manual fix. Cause: the chart renders its own configuration from values, and a mounted application.yaml or a hand-edited environment variable can override or conflict with the rendered result. Check: render the chart with the same values you deploy, compare the output with the files mounted in the running pods, and make every change through values so the chart stays the single source of truth.
How defaults, YAML files and environment variables combine at startup
The starter begins with its built-in defaults, then reads an application.yaml supplied by the image or a mounted volume, and finally applies environment variable overrides. The combined result is the running configuration that opens the database connection and switches modules on or off. Check the final values at startup, because the database credentials and any token or key settings pass through this path and belong inside the trust boundary, supplied by a secrets store rather than written into a file in the image.
Startup sources feed one merged configuration, with secrets kept behind a boundary.
Setting up and verifying application.yaml step by step
This sequence takes a HAPI FHIR JPA starter from an unconfigured build to a running server whose FHIR version, modules, database, secrets and public address have each been checked before go-live.
Confirm the JDK and HAPI FHIR version
Choose the HAPI FHIR release first, because it determines the Java runtime you must install. HAPI FHIR 8.2.0 requires JDK 17, and the latest release supplied for this page, v8.8.2, was released on 25 September 2026. Check the version compatibility notes in the HAPI FHIR documentation and confirm your JDK with java -version on the build and runtime hosts. The step is done when the target version, the JDK and the base image or application server you will use are written down together and match.
Set the FHIR version and enabled modules
Open application.yaml and set the FHIR version the server will expose (DSTU2, DSTU3, R4, R4B or R5, depending on what your clients and implementation guides need). Then review each module flag, such as terminology, validation, MDM or partitioning, and enable only what the current requirements call for. Every enabled module adds configuration and operational work later. Verify by starting the server in a non-production environment and confirming that the capability statement at the metadata endpoint reports the FHIR version and resource types you expect.
Point the datasource at PostgreSQL or SQL Server
Replace the default embedded H2 database with a production database. The starter supports PostgreSQL and Microsoft SQL Server for production and does not support MySQL. Set the datasource URL, username and driver for your chosen engine, and confirm the database account has the rights needed to create or update the schema on first start. The step is complete when the server connects to the external database and the logs show the schema initialized without errors. Database sizing and tuning are covered on separate pages.
Move secrets into environment variables or a secret store
Remove database passwords, client secrets and any other credentials from application.yaml. Supply them through environment variables or a secret store your platform already uses, such as a Kubernetes Secret or a vault, and reference them in the YAML. Confirm that the file in source control contains no credential values, and that the running process receives the expected values. A simple check is to search the repository and the container image layers for the password string, which should return nothing.
Set the public base URL
Set the server's public base address to the external URL that clients will use, including scheme and path. Links and Bundle entries returned by the server are built from this value, so an internal address or the wrong scheme will produce broken references, especially behind a reverse proxy or load balancer. Request a search or read through the public hostname and inspect the returned links. The step is done when every self link and Bundle entry uses the public address.
Start the server and check the health endpoint
Start the server with the final configuration, using the container, Compose, Kubernetes or application server method your team has chosen. Watch the startup log for schema migration messages and any configuration warnings, and allow for slower first starts while the schema is created. Then call the health endpoint exposed by the actuator configuration and confirm it reports the application and database as up. This check confirms the process runs, but not yet that the FHIR API behaves correctly.
Verify the capability statement and a sample request
Request the capability statement from the metadata endpoint through the public address. Confirm the FHIR version, the supported resource types, the interactions and any search parameters match what you configured and what your clients need. Then create one test resource, read it back and delete it in a non-production environment. The step is complete when the capability statement matches the design and the test resource round-trips correctly. Record the output as the baseline for later configuration changes.
Record the configuration and review before go-live
Store the final application.yaml, with secrets excluded, in version control alongside the build and deployment files, and tag the configuration with the HAPI FHIR version it was tested against. Review the settings that the starter leaves to you, including authorization, audit logging, backups and monitoring, using the production readiness checklist for the JPA starter. Re-run the health and capability checks after any change to the file, the version or the environment, so that each go-live has a documented, repeatable verification record.
Settings to review before go-live
The starter ships with defaults meant for trying the server out, not for running it with patient data. The settings below decide how the schema changes, what data gets stored, who can read it, and what ends up in your logs. Confirm each one against your own environment and written security requirements before go-live.
Database and schema migration behavior
The starter defaults to an embedded H2 database, so the first production change is pointing it at PostgreSQL or Microsoft SQL Server and confirming the connection settings in application.yaml or the matching environment variables. Check how schema creation and migration run on startup, who holds the database credentials, and whether a restore has been tested against a copy of the production schema. Confirm the database engine against the starter's supported list before you plan the rollout.
Enabled modules and their data impact
Each module you switch on, such as terminology services, validation, MDM or subscriptions, adds tables, indexes, background jobs or stored content. Before enabling one, list the data it will hold, how much storage it will consume, and whether it changes what a search or a read returns. Disable modules you do not need so the attack surface and the data footprint stay small, and record the reason for each enabled module in your change record.
Authorization and audit interceptors
HAPI FHIR does not provide a one-size-fits-all security layer. The starter exposes building blocks, such as the AuthorizationInterceptor and BALP audit logging, but nothing in the default configuration limits who can read or write a resource. Decide which interceptors protect each resource type, how identity provider tokens are validated, and where audit records are sent and retained. Have your security team review the access rules with test accounts before any real data is loaded.
Security documentationCORS and allowed origins
Browser applications need cross-origin settings to call the server, and a permissive origin list lets any website script requests made with a user's session. Set the allowed origins to the exact front-end hosts you operate, limit the allowed methods and headers to what those applications use, and confirm that credentials are only allowed for trusted origins. Test the policy from an unlisted origin to confirm it is refused.
Partitioning mode if used
If you enable partitioning, each resource is assigned to a partition for multitenancy, data source separation or regional grouping. Confirm the partition mode and the request header or tenant identifier clients must send, because a missing or wrong partition can route data to the wrong place. Decide who may create partitions, and test that a client scoped to one partition cannot read another partition's resources. Partitioning changes the schema, so confirm it before the first load rather than after.
Partitioning docsLogging levels that protect patient data
Debug and trace logging can record request bodies, resource contents and identifiers, which turns the log stream into a copy of the clinical record. Set the production log levels explicitly in the configuration, confirm that request and response payloads are not written at those levels, and check the log destinations, retention and access rights. Run a test search with a synthetic patient and review the resulting log lines before the server receives real data.
Questions teams ask before configuring the starter
How much effort does a configuration review take?
The effort depends mostly on how many environments need configuring, which modules are enabled, and how much security work sits on top of the server. A single development instance with the default embedded H2 database is a small job. A review that covers development, test and production, a PostgreSQL or Microsoft SQL Server database, partitioning, and access control tied to an existing identity provider is a much larger one. Each added environment multiplies the settings to verify, and each enabled module adds its own options and its own testing. Ask any provider to break the quote down by environment, module and security requirement so you can see what drives the number.
Can our internal team configure the starter without a partner?
Yes, a team with Java and Spring Boot experience can configure the starter alone, and the project documentation covers most settings. The harder parts are usually outside the YAML itself: choosing a production database, designing the security model, and proving to auditors that the settings match your policies. Teams that do it internally should plan time for testing each change against a non-production copy of the data, and for keeping documentation current after each upgrade. A partner adds the most value when the security, compliance or integration requirements are heavy, or when the team lacks capacity for ongoing review.
What do we need to provide before configuration work starts?
Four inputs make the work predictable. First, an inventory of every environment, its hosting platform and its network boundaries. Second, the database decision, meaning whether you will run PostgreSQL or Microsoft SQL Server and who operates it. Third, the security and compliance requirements, including authentication method, audit logging expectations and data handling rules. Fourth, a test environment that resembles production closely enough to validate changes before go-live. Missing any of these usually extends the review, because decisions get deferred until the gaps are closed. Confirm the list with your provider before the scope is agreed.
How do configuration changes differ between Docker, Kubernetes and WAR deployments?
The settings are the same, but how you deliver them changes. In the hapiproject/hapi Docker image, you pass values as environment variables or mount an application.yaml file into the container. With Docker Compose, the same approach applies, with the file typically mounted from the host. On Kubernetes with the Helm chart, values usually flow through chart values, ConfigMaps and Secrets, so a change becomes a new rollout. In a WAR deployed to Tomcat, Jetty or Wildfly, the file usually sits in the application server's configuration path and changes require a restart. Confirm the exact precedence and reload behavior for your chosen method against the project documentation and your own test runs.
Should secrets go in environment variables or a mounted YAML file?
Keep secrets out of the YAML file that lives in source control. Environment variables are the common choice for database passwords and API keys because the container runtime or orchestrator can inject them from a secret store. A mounted YAML file works well for non-secret settings such as enabled modules, FHIR version and server address, and it is easier to review in a pull request. Many teams use both: the file holds structure and defaults, and secrets arrive as environment variables from a vault or Kubernetes Secret. Check who can read the process environment inside the container, because that is a common leak path, and confirm your secret manager's rotation process before go-live.
How should we plan configuration changes during an upgrade?
Treat configuration as part of the upgrade, not a follow-up task. Each HAPI FHIR release can change property names, defaults, module behavior and schema migrations, so compare the previous and new configuration files before deploying. Keep the YAML in version control, run the new version against a copy of production data, and record every changed key in the change log. The HAPI FHIR upgrade documentation lists version-specific changes, and the Java requirement for the target version matters too, since HAPI FHIR 8.2.0 requires JDK 17. Plan a rollback path that includes the previous configuration and the database state.
Which settings should we review before go-live?
Focus on the settings that affect data, access and exposure. Confirm the FHIR version and enabled modules, since each one adds endpoints and data that need access control. Check the database connection and the schema behavior, and confirm that the embedded H2 database is not used in production. Review the public server address so generated links are correct, authentication and authorization interceptors, CORS settings for browser apps, and audit logging. HAPI FHIR does not provide a single security layer, so each building block needs an explicit decision. Document each choice so reviewers can trace it back to a requirement.
How DeployOpen scopes a HAPI FHIR configuration review
DeployOpen starts every configuration review from a written scope agreed before any settings change. The scope begins with an environment inventory: which HAPI FHIR version is in use or planned, the JDK available on the target hosts (HAPI FHIR 8.2.0 requires JDK 17), the FHIR versions the server must expose, and which modules are intended to be switched on. It also records where configuration will live, whether as environment variables, a mounted application.yaml, or layered files per environment. Confirm the exact version you intend to run against the HAPI FHIR versions page before the review starts, since the Java requirement and configuration keys can change between releases.
The second part of the scope fixes the deployment method and the non-functional requirements that configuration must satisfy. The method determines how overrides reach the process, whether through a container image, a Compose file, a Helm values file, or a WAR on an existing application server. The database requirement sets the datasource settings to be reviewed, and the starter's supported production databases are PostgreSQL and Microsoft SQL Server, with MySQL not supported. Security requirements define which authentication, authorization, audit and CORS settings must be reviewed, because HAPI FHIR provides building blocks rather than a single security layer. Your security and compliance leads should attend the scoping session so these decisions are made once, not discovered at go-live.
The deliverables are a set of configuration files for each environment, a go-live checklist that maps each setting to an owner and a verification step, and a decision record that explains every non-default choice and the alternatives considered. Acceptance checks are agreed in the same document: for example, the server starts with the intended FHIR version and modules, the datasource points at the production database, the public server address produces correct links, and unauthenticated requests are refused where policy requires. Ask for the acceptance checks in writing, and ask who signs them off. Pricing and timelines follow from the written scope and are provided in the quote, not estimated here.
How DeployOpen works on this
DeployOpen plans, implements, documents and supports self-hosted open-source platforms inside your own infrastructure, including the configuration of the HAPI FHIR JPA starter. Each engagement starts from a written scope that sets out which settings, profiles and environments the work covers before any configuration changes are made.
How we scope
- Inventory the target environments, database choice, FHIR version and modules the server must run
- Agree in writing which settings, environment variable mappings and layered YAML files are in scope
- Define the go-live review list, including security, audit logging and backup settings, before build starts
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work begins
How we build
- Build the base application.yaml and per-environment overrides in your version control system
- Map secrets and database credentials to environment variables rather than committing them to files
- Enable only the agreed modules and check each setting against the chosen HAPI FHIR release notes
- Test startup, FHIR capability statement output and search behavior in a non-production environment first
How we hand over
- Deliver a documented configuration reference listing each key, its default, its override and its owner
- Provide a go-live checklist covering the settings your security and compliance teams need to review
- Walk your platform and security engineers through the configuration model and change process
- Record the exact HAPI FHIR and Java versions tested so later upgrades start from a known baseline
How we support
- Review configuration changes when you upgrade HAPI FHIR, since defaults and key names can change between releases
- Offer ongoing support, upgrades and continuous testing as a retainer after the initial handover
- Retest configuration after changes to database, identity provider or reverse proxy settings
- Keep configuration documentation current so your team can run changes without rebuilding the setup

