Automatically detect 'development' profile
Detect when an application is running in development (by the presence of a build file) and automatically add a 'development' profile. Additional detectors can be developed by implementing the `ProfileDetector` interface and registering with the `SpringApplication` Fixes gh-296
This commit is contained in:
@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -43,6 +44,8 @@ public class SampleSimpleApplication implements CommandLineRunner {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
SpringApplication.run(SampleSimpleApplication.class, args);
|
||||
ConfigurableApplicationContext context = SpringApplication.run(
|
||||
SampleSimpleApplication.class, args);
|
||||
System.out.println(context.getEnvironment().acceptsProfiles("development"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user