1

I am having two active profiles in my module in Java. I am trying to specify it in kubernetes like this:

env:
  - name: spring_profiles_active
    value: ["dev", "shop-module"]

Is the correct way to specify the two active configs?

  • 1
    If it is a normal Spring boot application deployment then this works: spring.profiles.active=dev,hsqldb – Arun Sai Mustyala Aug 04 '21 at 13:33
  • Wow, great answer mate! Doesn't makes a sense to me how this works as one string, but it's fine now :) –  Aug 04 '21 at 13:37

2 Answers2

0

Multiple active profiles can be configured in the below way:

application.properties

spring.profiles.active=dev,hsqldb

(or)

application.yml

spring:
  profiles:
    active: "dev,hsqldb"
Arun Sai Mustyala
  • 1,736
  • 1
  • 11
  • 27
-1

how do you pass it while on command line ?? it will be supported surely if can be done via command line or you can do outside of kubernetes

try this link,

How can I specify the spring.profiles.active param with a value from an environment variable using fabric8 maven plugin?

Siddique Ahmad
  • 107
  • 2
  • 8
  • you mean in intelliJ ??? it is spring: profiles: active: - "dev" - "shop-module" –  Aug 04 '21 at 13:17
  • but this is not related. I am asking how to specify more than one active profiles.... –  Aug 04 '21 at 13:29
  • 1
    Dspring.profiles.active="default,dev", it shows that we should use string rather array, try without array – Siddique Ahmad Aug 04 '21 at 13:40