Is it possible to have a profile in spring boot and also another profile that inherits most of the parent values and beans?
For example I have two profiles
staging and staging-task.
I want staging-task to inherit the database configuration of the staging profile however I want it to override the jpa configuration.
Is profile inheritance available to @Configuration beans.
Yes. Its possible to have spring profiles in spring boot.
For your problem, put your common database configuration in application.yml(default profile).
And you can override the other properties in application-stage.yml.
Spring will read the properties from application.yml and override from application-stage.yml when active profile is stage.
Answered By – Jaydeep Rajput
Answer Checked By – Terry (Easybugfix Volunteer)