Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't know of any way to achieve this without custom code which would manipulate the active profiles in a <code>ConfigurableEnvironment</code>.</p> <p>We're trying to achieve the same indirection pattern as rights vs. roles (group of rights) in a security framework, but since this doesn't come out of the box, I ended up having to work around it. </p> <p>I kept my profiles general, e.g. production and super-fast in your case, and for each bean that is sensitive to those profiles, I set the correct @Profile. To make refactoring easier, I used two techniques.</p> <ol> <li>Create a meta-annotation for each profile, e.g. <code>@Production</code>, <code>@SuperFast</code> and make the profile name a public constant, e.g. <code>Production.PROFILE_NAME = "production"</code>.</li> <li>When marking the profile of any bean, use your new meta-annotation if it only applies to one profile, or use <code>@Profile({Production.PROFILE_NAME, ...})</code> if it applies to multiple profiles. You have to do this because you can't apply two profile meta-annotations to the same bean, <a href="https://jira.springsource.org/browse/SPR-10812" rel="nofollow">at least not until 4.0</a>.</li> </ol> <p>For example,</p> <pre><code>@Profile(Production.PROFILE_NAME) public @interface Production { public static String PROFILE_NAME = "production"; } </code></pre> <p>The point of all this is that you can now use your IDE to look for usages of <code>@Production</code> or <code>Production.PROFILE_NAME</code> if you need to quickly understand or change what beans are being pulled in. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload