I have an application, for which I can specify the profiles I want to run it on. but I also want to group these profiles into things like credentails, application performance, memory-print, application behaviour etc. Ex. I can run the following profiles
-Dspring.profiles.active=production,cached-local,db-connection-pooled...
but I would prefer initializing it as
-Dspring.profiles.active=production,super-fast
#the above activates method level caches, db connection pooling etc
#super-fast triggered activation of cached-local, db-connection-pooled profiles
or
-Dspring.profiles.active=dev,low-footprint
#the above dosent enable caching, or db connection pooling
can this be achieved without writing any custom code like How to set active spring 3.1 environment profile via a properites file and not via an env variable or system property. I am fine even if I can load these from properties files or inside spring-xml config. I am using xml only config on spring 3.1.
Spring Boot have since added functionality to address this problem, called "Profile Groups". A profile group allows you to define a logical name for a related group of profiles.
For example, we can create a production group that consists of our proddb and prodmq profiles.
This allows for a grouping to be defined, which is added to the spring-profiles-active, which when enabled, in turn, enables other profiles.
For more information see https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.profiles.groups
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With