Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/shyamz-22/conditional-profiles
- Owner: shyamz-22
- License: mit
- Created: 2016-04-19T14:02:09.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-06T09:07:03.000Z (about 7 years ago)
- Last Synced: 2024-11-15T06:55:39.544Z (about 2 months ago)
- Topics: java, kotlin, scala, spring, spring-profile, springboot
- Language: Java
- Size: 110 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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```