Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 1.08 KB

README.md

File metadata and controls

27 lines (18 loc) · 1.08 KB

nrich-spring-boot

Maven Central

Overview

nrich-spring-boot is a module containing add-ons on Spring Boot framework. Currently, no additional configuration is needed, just adding the module as dependency is enough. This module contains only ConditionalOnPropertyNotEmpty annotation (for now). It is used to register beans only when property is not empty, it supports strings, list of strings and lists of objects.

Usage

@Configuration(proxyBeanMethods = false)
public class ApplicationConfiguration {

    @ConditionalOnPropertyNotEmpty("example.bean.condition.list")
    @Bean
    public ExampleBean exampleBean() {
        return new ExampleBean();
    }
}

For usage, it is enough to add annotation to bean that should only be registered when property is not empty. In former example bean ExampleBean will only be registered when property example.bean.condition.list is not empty.