title: Activating Spring @Profile Using JNDI
body: <p>I'm currently using Spring <code>@Profile</code> to manage my web application's configuration based on the environment (DEV, TEST, PROD). In order to activate the right profile, I prefer not to hardcode the value for <code>spring.profiles.active</code> in <code>web.xml</code>. Rather, I want to rely on the JNDI from the server to determine the right profile to activate. I'm able to get this working by creating a JNDI string called <code>spring.profiles.active</code> with the value, say DEV, to activate the DEV profile in my web application.</p>
  
  <p>The problem is my server environment already has a custom JNDI ( say, <code>bla/environment</code> ) that contains the value DEV, TEST or PROD. </p>
  
  <p>Is it possible to set <code>spring.profiles.active</code> based on this custom JNDI so that I don't have to create another JNDI that does the same thing?</p>
  
  <p>Thank you.</p>