Conditional On Profiles

Create a Spring Bean only if All profiles are active.

License

License

GroupId

GroupId

io.github.shyamz-22
ArtifactId

ArtifactId

conditional
Last Version

Last Version

0.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

Conditional On Profiles
Create a Spring Bean only if All profiles are active.
Project URL

Project URL

https://github.com/shyamz-22/conditional-profiles.git
Source Code Management

Source Code Management

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

Download conditional

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.shyamz-22/conditional/ -->
<dependency>
    <groupId>io.github.shyamz-22</groupId>
    <artifactId>conditional</artifactId>
    <version>0.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.shyamz-22/conditional/
implementation 'io.github.shyamz-22:conditional:0.0.2'
// https://jarcasting.com/artifacts/io.github.shyamz-22/conditional/
implementation ("io.github.shyamz-22:conditional:0.0.2")
'io.github.shyamz-22:conditional:jar:0.0.2'
<dependency org="io.github.shyamz-22" name="conditional" rev="0.0.2">
  <artifact name="conditional" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.shyamz-22', module='conditional', version='0.0.2')
)
libraryDependencies += "io.github.shyamz-22" % "conditional" % "0.0.2"
[io.github.shyamz-22/conditional "0.0.2"]

Dependencies

compile (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter jar

test (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar

Project Modules

There are no modules declared in this project.

Conditional Profiles

Build Status codecov MavenCentral License: MIT

Default Spring profile behavior

Creates the bean when Profile A OR B is active.

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

Conditional On Profiles

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

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

Installation

Gradle

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

Maven

<dependency>
    <groupId>io.github.shyamz-22</groupId>
    <artifactId>conditional</artifactId>
    <version>0.0.2</version>
</dependency>

Versions

Version
0.0.2
unspecified