title: In a SpringBoot application, how to set @ConfigurationProperties(prefix = ...) dynamically?
body: <p>I wrote a small application which includes a <code>@ConfigurationProperties(prefix = ...)</code> annotation to load the correct configuration for one of the beans. This has been working fine and I've been manually changing the <code>prefix</code> value in my IDE as needed when testing against different environments.</p>
  
  <p>Now I need to clean this up and ensure the application can run in different environments without a recompile. The value needs to be parameterized. How can I set the prefix dynamically at run-time?</p>
  
  <p>Related Questions</p>
  
  <p>This other question references a specific approach which doesn't work, using spEL: </p>
  
  <blockquote>
    <p><a href="https://stackoverflow.com/questions/43357078/property-in-configurationproperties-prefix">Property in @ConfigurationProperties prefix</a></p>
  </blockquote>
  
  <p>and this one says you can't use it YAML (which I don't care about)</p>
  
  <blockquote>
    <p><a href="https://stackoverflow.com/questions/45557138/how-to-implement-dynamic-configurationproperties-prefix">How to implement dynamic @ConfigurationProperties Prefix</a></p>
  </blockquote>
  
  <p>I'm looking more generally, for any working solution.</p>