Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shyamz-22/conditional-profiles

Make a bean only when two profiles are active
https://github.com/shyamz-22/conditional-profiles

java kotlin scala spring spring-profile springboot

Last synced: 3 days ago
JSON representation

Make a bean only when two profiles are active

Awesome Lists containing this project

README

        

# Conditional Profiles

[![Build Status](https://travis-ci.org/shyamz-22/conditional-profiles.svg?branch=master)](https://travis-ci.org/shyamz-22/conditional-profiles)
[![codecov](https://codecov.io/gh/shyamz-22/conditional-profiles/branch/master/graph/badge.svg)](https://codecov.io/gh/shyamz-22/conditional-profiles)
[![MavenCentral](https://maven-badges.herokuapp.com/maven-central/io.github.shyamz-22/conditional/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.shyamz-22/conditional)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

### Default Spring profile behavior

Creates the bean when Profile A **OR** B is active.

```java
@Bean
@Profile("A", "B")
public ExampleBean exampleBean() {
return new ExampleBean();
}
```

### Conditional On Profiles

Creates the bean only when Profile A **AND** B are active.

```java
@Bean
@ConditionalOnProfiles("A","B")
public ExampleBean exampleBean() {
return new ExampleBean();
}
```

## Installation

### Gradle

```gradle
compile 'io.github.shyamz-22:conditional:0.0.2'
```

### Maven

```xml

io.github.shyamz-22
conditional
0.0.2

```