Example usage for org.springframework.boot.builder SpringApplicationBuilder properties

List of usage examples for org.springframework.boot.builder SpringApplicationBuilder properties

Introduction

In this page you can find the example usage for org.springframework.boot.builder SpringApplicationBuilder properties.

Prototype

public SpringApplicationBuilder properties(Map<String, Object> defaults) 

Source Link

Document

Default properties for the environment.

Usage

From source file:com.netflix.spinnaker.fiat.Main.java

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.properties(DEFAULT_PROPS).sources(Main.class);
}

From source file:demo.ChildTestContext.java

@Override
public ApplicationContext getApplicationContext() {
    ApplicationContext parent = super.getApplicationContext();
    ApplicationContext context = parent;
    if (this.method != null) {
        SpringApplicationBuilder builder = null;
        ChildSpringApplication annotation = AnnotatedElementUtils.getMergedAnnotation(this.method,
                ChildSpringApplication.class);
        if (annotation != null) {
            if (annotation.classes().length > 0) {
                builder = new SpringApplicationBuilder();
                for (Class<?> source : annotation.classes()) {
                    builder.sources(source);
                }/*from ww  w. j a  v  a2  s  .co m*/
            }
        }
        ChildTestProperties properties = AnnotatedElementUtils.getMergedAnnotation(this.method,
                ChildTestProperties.class);
        if (properties != null) {
            if (properties.value().length > 0) {
                if (builder == null) {
                    builder = new SpringApplicationBuilder();
                }
                for (String source : properties.value()) {
                    builder.properties(source);
                }
            }
        }
        if (builder != null) {
            this.closeable = builder.sources(PropertyPlaceholderAutoConfiguration.class).bannerMode(Mode.OFF)
                    .web(false).parent((ConfigurableApplicationContext) parent).run();
            context = this.closeable;
        }
    }
    return context;
}