allow subclassing of SpringApplicationBuilder

This commit is contained in:
Graeme Rocher 2014-05-27 14:11:34 +02:00 committed by Dave Syer
parent 021f8eba03
commit 514dad6d22
1 changed files with 13 additions and 2 deletions

View File

@ -80,10 +80,21 @@ public class SpringApplicationBuilder {
private boolean registerShutdownHookApplied;
public SpringApplicationBuilder(Object... sources) {
this.application = new SpringApplication(sources);
this.application = createSpringApplication(sources);
}
/**
/**
* Creates a new {@link org.springframework.boot.SpringApplication} instances from the given sources. Subclasses may
* override in order to provide a custom subclass of {@link org.springframework.boot.SpringApplication}
*
* @param sources The sources
* @return The {@link org.springframework.boot.SpringApplication} instance
*/
protected SpringApplication createSpringApplication(Object... sources) {
return new SpringApplication(sources);
}
/**
* Accessor for the current application context.
* @return the current application context (or null if not yet running)
*/