Skip to content

Spring Profile Management

Jeremy Zitomer edited this page Feb 26, 2021 · 25 revisions

We need to outline our best (or at least, shared) practices. This page will do that. It doesn't yet.

Our current practice is to have two (mostly) sets of bean profiles: profiles that activate or deactivate beans directly within the application context, and profiles that are linked to a deployment environment and include profiles from the first set within them.

Profiles within the code

See the BeanProfiles class for profiles that can be used within the code. At the time of this writing they are no-security, single-tenant, and auth-dev. In addition, there is a test profile for integration tests, though this should probably be removed (or at least moved out of src/main). These profiles are mainly incorporated into deployment profiles by way of the spring.profiles.include property.

Profiles for deployment

Profiles that are intended to define a deployment environment include:

  • dev (local development, though also used for some tests)
  • local is a special case profile that is ignored by git so that local property overrides can be made without editing a version-controlled file. It is automatically included in the dev profile, but otherwise ignored.
  • prod (original production deployment)
  • cloud (any deployment to cloud.gov or other PCF instance)
  • azure-dev, azure-demo, azure-staging and azure-prod, which are the eventual profiles for deploying through managed infrastructure.

In addition, we have one set of "facet" profiles to link API deployments to Okta environments: okta-dev, okta-stg and okta-prod. These should be included in deployment-specific profiles using spring.profiles.include, as if they were bean-activating profiles.

Profile Authentication Contains Profiles Comments
no-security None
no-okta-mgmt N/A
single-tenant
create-sample-data
Environment azure-* okta-* no-security single-tenant no-okta-mgmt create-sample-data auth-dev local
prod Y Y
demo Y Y Y Y Y
training Y Y Y Y Y
pentest Y Y
stg Y Y
dev Y Y Y
test Y Y Y
local Y Y Y Y Y
unit tests Y Y Y

Did we miss any?

See src/main/resources or grep for @Profile in src/ to find out!

Local development

Setup

How to

Development process and standards

Oncall

Technical resources

How-to guides

Environments/Azure

Misc

?

Clone this wiki locally