Package org.springframework.boot.builder
Class SpringApplicationBuilder
java.lang.Object
org.springframework.boot.builder.SpringApplicationBuilder
Builder for
SpringApplication and ApplicationContext instances with
convenient fluent API and context hierarchy support. Simple example of a context
hierarchy:
new SpringApplicationBuilder(ParentConfig.class).child(ChildConfig.class).run(args);Another common use case is setting active profiles and default properties to set up the environment for an application:
new SpringApplicationBuilder(Application.class).profiles("server")
.properties("transport=local").run(args);
If your needs are simpler, consider using the static convenience methods in SpringApplication instead.
- Since:
- 1.0.0
- Author:
- Dave Syer, Andy Wilkinson
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSpringApplicationBuilder(Class<?>... sources) SpringApplicationBuilder(ResourceLoader resourceLoader, Class<?>... sources) -
Method Summary
Modifier and TypeMethodDescriptionaddBootstrapRegistryInitializer(BootstrapRegistryInitializer bootstrapRegistryInitializer) AddsBootstrapRegistryInitializerinstances that can be used to initialize theBootstrapRegistry.addCommandLineProperties(boolean addCommandLineProperties) Flag to indicate that command line arguments should be added to the environment.allowCircularReferences(boolean allowCircularReferences) Whether to allow circular references between beans and automatically try to resolve them.Accessor for the current application.applicationStartup(ApplicationStartup applicationStartup) Configure theApplicationStartupto be used with theApplicationContextfor collecting startup metrics.Sets theBannerinstance which will be used to print the banner when no static banner file is provided.