How to conditionally declare Bean when multiple profiles are not active?
<p>In my Spring-Boot-App I want to conditionally declare a Bean, depending on (un)loaded spring-profiles.</p>

<p>The conditon:</p>

<pre><code>Profile "a" NOT loaded  
AND  
Profile "b" NOT loaded 
</code></pre>

<p>My solution so far (which works):</p>

<pre><code>@Bean
@ConditionalOnExpression("#{!environment.getProperty('spring.profiles.active').contains('a') &amp;&amp; !environment.getProperty('spring.profiles.active').contains('b')}")
    public MyBean myBean(){/*...*/}
</code></pre>

<p>Is there a more elegant (and shorter) way to explain this condition?<br>
Especially I want to get rid of the usage of Spring Expression Language here.</p>