Creates the bean when Profile A OR B is active.
@Bean
@Profile("A", "B")
public ExampleBean exampleBean() {
return new ExampleBean();
}
Creates the bean only when Profile A AND B are active.
@Bean
@ConditionalOnProfiles("A","B")
public ExampleBean exampleBean() {
return new ExampleBean();
}
compile 'io.github.shyamz-22:conditional:0.0.2'
<dependency>
<groupId>io.github.shyamz-22</groupId>
<artifactId>conditional</artifactId>
<version>0.0.2</version>
</dependency>