Skip to content

Commit

Permalink
Add condition for bean
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibault Helsmoortel committed Nov 18, 2019
1 parent 0c8b2e0 commit 717af07
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.github.thibstars.profiles.SpringProfileUtils;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
Expand All @@ -39,6 +40,7 @@ public class SpringProfileUtilsAutoConfiguration {
private final Environment environment;

@Bean
@ConditionalOnMissingBean(SpringProfileUtils.class)
public SpringProfileUtils springProfileUtils() {
return new SpringProfileUtils(environment);
}
Expand Down

0 comments on commit 717af07

Please sign in to comment.