0

I'm using Spring 3.1.3 and the new profile feature. When I set the environment in my IDE for spring_profiles_active=NONPROD, it works fine. However, when I deploy to our aPaaS environment which is also using Tomcat, it isn't getting picked up.

Shouldn't I just be able to do the following:

env:
  CATALINA_OPTS: -Dspring_profiles_active=NONPROD

If I ssh to the machine, I see this is getting set. Any ideas why Spring isn't picking this up?

Kaitsu
  • 4,094
  • 3
  • 30
  • 37
occasl
  • 5,303
  • 5
  • 56
  • 81
  • The property name should be `spring.profiles.active` - dots not underscores :) – kevin847 May 29 '13 at 22:16
  • As I understand it, both are acceptable but neither work. In my IDE, I've used underscore, np. – occasl May 29 '13 at 22:28
  • That was news to me, but you're right enough. Sorry. – kevin847 May 30 '13 at 09:06
  • I like the suggestion here of debugging environment variables by implementing the EnvironmentAware interface: http://stackoverflow.com/questions/14089301/how-to-get-spring-to-print-out-what-spring-profiles-are-active – kevin847 May 30 '13 at 09:06

1 Answers1

1

Put the following lines to your manifest.yml file to get the Spring profile activated in Stackato:

env:
      spring_profiles_active:
        default: NONPROD

This will put spring_profiles_active into environment variable and Spring happily reads it from there. Note that you have to use underscores in the variable name, because Stackato doesn't like dots in those. The reason is that Linux environment variable names shouldn't contain dots for shell programs to work correctly with them.

Kaitsu
  • 4,094
  • 3
  • 30
  • 37