org.springframework.core.env.SimpleCommandLinePropertySource源码实例Demo

类org.springframework.core.env.SimpleCommandLinePropertySource源码实例Demo

下面列出了怎么用org.springframework.core.env.SimpleCommandLinePropertySource的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: spring-javaformat   文件: SpringApplication.java
/**
 * Add, remove or re-order any {@link PropertySource}s in this application's
 * environment.
 * @param environment this application's environment
 * @param args arguments passed to the {@code run} method
 * @see #configureEnvironment(ConfigurableEnvironment, String[])
 */
protected void configurePropertySources(ConfigurableEnvironment environment,
		String[] args) {
	MutablePropertySources sources = environment.getPropertySources();
	if (this.defaultProperties != null && !this.defaultProperties.isEmpty()) {
		sources.addLast(
				new MapPropertySource("defaultProperties", this.defaultProperties));
	}
	if (this.addCommandLineProperties && args.length > 0) {
		String name = CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME;
		if (sources.contains(name)) {
			PropertySource<?> source = sources.get(name);
			CompositePropertySource composite = new CompositePropertySource(name);
			composite.addPropertySource(new SimpleCommandLinePropertySource(
					"springApplicationCommandLineArgs", args));
			composite.addPropertySource(source);
			sources.replace(name, composite);
		}
		else {
			sources.addFirst(new SimpleCommandLinePropertySource(args));
		}
	}
}
 
源代码2 项目: seed   文件: OpenRun.java
private static String getProfile(SimpleCommandLinePropertySource source){
    if(source.containsProperty(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到spring变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, source.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return source.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getProperties().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到java变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getenv().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到系统变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getenv(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getenv(SeedConstants.BOOT_ACTIVE_NAME);
    }
    log.warn("未读取到{},默认取环境:{}", SeedConstants.BOOT_ACTIVE_NAME, SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE);
    return SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE;
}
 
源代码3 项目: seed   文件: QssRun.java
private static String getProfile(SimpleCommandLinePropertySource source){
    if(source.containsProperty(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到spring变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, source.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return source.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getProperties().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到java变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getenv().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到系统变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getenv(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getenv(SeedConstants.BOOT_ACTIVE_NAME);
    }
    log.warn("未读取到{},默认取环境:{}", SeedConstants.BOOT_ACTIVE_NAME, SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE);
    return SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE;
}
 
源代码4 项目: seed   文件: BootRun.java
private static String getProfile(SimpleCommandLinePropertySource source){
    if(source.containsProperty(SeedConstants.BOOT_ACTIVE_NAME)){
        //补充:IntelliJ IDEA运行时,如果在Run/Debug Configurations为该启动类配置Program arguments的值为"--spring.profiles.active=dev"
        //那么这里就能读取到该配置,同时控制台会打印"读取到spring变量:spring.profiles.active=dev"
        log.info("读取到spring变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, source.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return source.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getProperties().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到java变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getenv().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到系统变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getenv(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getenv(SeedConstants.BOOT_ACTIVE_NAME);
    }
    log.warn("未读取到{},默认取环境:{}", SeedConstants.BOOT_ACTIVE_NAME, SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE);
    //logback-boot.xml中根据环境变量配置日志是否输出到控制台时,使用此配置
    System.setProperty(SeedConstants.BOOT_ACTIVE_NAME, SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE);
    return SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE;
}
 
源代码5 项目: seed   文件: MppRun.java
private static String getProfile(SimpleCommandLinePropertySource source){
    if(source.containsProperty(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到spring变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, source.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return source.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getProperties().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到java变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getProperty(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getProperty(SeedConstants.BOOT_ACTIVE_NAME);
    }
    if(System.getenv().containsKey(SeedConstants.BOOT_ACTIVE_NAME)){
        log.info("读取到系统变量:{}={}", SeedConstants.BOOT_ACTIVE_NAME, System.getenv(SeedConstants.BOOT_ACTIVE_NAME));
        return System.getenv(SeedConstants.BOOT_ACTIVE_NAME);
    }
    log.warn("未读取到{},默认取环境:{}", SeedConstants.BOOT_ACTIVE_NAME, SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE);
    return SeedConstants.BOOT_ACTIVE_DEFAULT_VALUE;
}
 
源代码6 项目: jhipster-ribbon-hystrix   文件: GatewayApp.java
/**
 * Main method, used to run the application.
 *
 * @param args the command line arguments
 * @throws UnknownHostException if the local host name could not be resolved into an address
 */
public static void main(String[] args) throws UnknownHostException {
    SpringApplication app = new SpringApplication(GatewayApp.class);
    SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
    addDefaultProfile(app, source);
    Environment env = app.run(args).getEnvironment();
    log.info("\n----------------------------------------------------------\n\t" +
            "Application '{}' is running! Access URLs:\n\t" +
            "Local: \t\thttp://127.0.0.1:{}\n\t" +
            "External: \thttp://{}:{}\n----------------------------------------------------------",
        env.getProperty("spring.application.name"),
        env.getProperty("server.port"),
        InetAddress.getLocalHost().getHostAddress(),
        env.getProperty("server.port"));

    String configServerStatus = env.getProperty("configserver.status");
    log.info("\n----------------------------------------------------------\n\t" +
    "Config Server: \t{}\n----------------------------------------------------------",
        configServerStatus == null ? "Not found or not setup for this application" : configServerStatus);
}
 
源代码7 项目: jhipster-ribbon-hystrix   文件: BarApp.java
/**
 * Main method, used to run the application.
 *
 * @param args the command line arguments
 * @throws UnknownHostException if the local host name could not be resolved into an address
 */
public static void main(String[] args) throws UnknownHostException {
    SpringApplication app = new SpringApplication(BarApp.class);
    SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
    addDefaultProfile(app, source);
    Environment env = app.run(args).getEnvironment();
    log.info("\n----------------------------------------------------------\n\t" +
            "Application '{}' is running! Access URLs:\n\t" +
            "Local: \t\thttp://127.0.0.1:{}\n\t" +
            "External: \thttp://{}:{}\n----------------------------------------------------------",
        env.getProperty("spring.application.name"),
        env.getProperty("server.port"),
        InetAddress.getLocalHost().getHostAddress(),
        env.getProperty("server.port"));

    String configServerStatus = env.getProperty("configserver.status");
    log.info("\n----------------------------------------------------------\n\t" +
    "Config Server: \t{}\n----------------------------------------------------------",
        configServerStatus == null ? "Not found or not setup for this application" : configServerStatus);
}
 
源代码8 项目: jhipster-ribbon-hystrix   文件: FooApp.java
/**
 * Main method, used to run the application.
 *
 * @param args the command line arguments
 * @throws UnknownHostException if the local host name could not be resolved into an address
 */
public static void main(String[] args) throws UnknownHostException {
    SpringApplication app = new SpringApplication(FooApp.class);
    SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
    addDefaultProfile(app, source);
    Environment env = app.run(args).getEnvironment();
    log.info("\n----------------------------------------------------------\n\t" +
            "Application '{}' is running! Access URLs:\n\t" +
            "Local: \t\thttp://127.0.0.1:{}\n\t" +
            "External: \thttp://{}:{}\n----------------------------------------------------------",
        env.getProperty("spring.application.name"),
        env.getProperty("server.port"),
        InetAddress.getLocalHost().getHostAddress(),
        env.getProperty("server.port"));

    String configServerStatus = env.getProperty("configserver.status");
    log.info("\n----------------------------------------------------------\n\t" +
    "Config Server: \t{}\n----------------------------------------------------------",
        configServerStatus == null ? "Not found or not setup for this application" : configServerStatus);
}
 
源代码9 项目: gpmr   文件: GpmrApp.java
/**
 * Main method, used to run the application.
 *
 * @param args the command line arguments
 * @throws UnknownHostException if the local host name could not be resolved into an address
 */
public static void main(String[] args) throws UnknownHostException {
    SpringApplication app = new SpringApplication(GpmrApp.class);
    SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
    addDefaultProfile(app, source);
    Environment env = app.run(args).getEnvironment();
    log.info("\n----------------------------------------------------------\n\t" +
            "Application '{}' is running! Access URLs:\n\t" +
            "Local: \t\thttp://127.0.0.1:{}\n\t" +
            "External: \thttp://{}:{}\n----------------------------------------------------------",
        env.getProperty("spring.application.name"),
        env.getProperty("server.port"),
        InetAddress.getLocalHost().getHostAddress(),
        env.getProperty("server.port"));

}
 
/**
 * Main method, used to run the application.
 */
public static void main(String[] args) throws UnknownHostException {
    SpringApplication app = new SpringApplication(Application.class);
    app.setShowBanner(false);
    SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
    addDefaultProfile(app, source);
    addLiquibaseScanPackages();
    Environment env = app.run(args).getEnvironment();
    log.info("Access URLs:\n----------------------------------------------------------\n\t" +
        "Local: \t\thttp://127.0.0.1:{}\n\t" +
        "External: \thttp://{}:{}\n----------------------------------------------------------",
        env.getProperty("server.port"),
        InetAddress.getLocalHost().getHostAddress(),
        env.getProperty("server.port"));

}
 
源代码11 项目: ServiceCutter   文件: Application.java
/**
 * Main method, used to run the application.
 */
public static void main(String[] args) throws UnknownHostException {
    SpringApplication app = new SpringApplication(Application.class);
    app.setShowBanner(false);
    SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
    addDefaultProfile(app, source);
    addLiquibaseScanPackages();
    Environment env = app.run(args).getEnvironment();
    log.info("Access URLs:\n----------------------------------------------------------\n\t" +
        "Local: \t\thttp://127.0.0.1:{}\n\t" +
        "External: \thttp://{}:{}\n----------------------------------------------------------",
        env.getProperty("server.port"),
        InetAddress.getLocalHost().getHostAddress(),
        env.getProperty("server.port"));

}
 
源代码12 项目: swagger-brake   文件: SwaggerBrakeMain.java
/**
 * Constructs the CLI interface.
 * @param args the arguments
 * @return the CLI interface object
 */
public static Cli createCliInterface(String[] args) {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(CliConfiguration.class);
    ConfigurableEnvironment environment = context.getEnvironment();
    environment.getPropertySources().addFirst(new SimpleCommandLinePropertySource(args));
    return context.getBean(Cli.class);
}
 
源代码13 项目: seed   文件: BootRun.java
public static void main(String[] args) {
    //SpringApplication.run(BootRun.class, args);
    //new SpringApplicationBuilder().sources(BootRun.class).profiles(getProfile(new SimpleCommandLinePropertySource(args))).run(args);
    new SpringApplicationBuilder().sources(BootRun.class)
            .listeners(new ApplicationStartingEventListener())
            .listeners(new ApplicationEnvironmentPreparedEventListener())
            .listeners(new ApplicationPreparedEventListener())
            .listeners(new ApplicationFailedEventListener())
            .listeners(new ApplicationPidFileWriter())
            .profiles(getProfile(new SimpleCommandLinePropertySource(args)))
            .run(args);
}
 
源代码14 项目: jhipster-ribbon-hystrix   文件: GatewayApp.java
/**
 * If no profile has been configured, set by default the "dev" profile.
 */
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active") &&
            !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {

        app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
    }
}
 
源代码15 项目: jhipster-ribbon-hystrix   文件: BarApp.java
/**
 * If no profile has been configured, set by default the "dev" profile.
 */
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active") &&
            !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {

        app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
    }
}
 
源代码16 项目: jhipster-ribbon-hystrix   文件: FooApp.java
/**
 * If no profile has been configured, set by default the "dev" profile.
 */
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active") &&
            !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {

        app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
    }
}
 
源代码17 项目: huanhuan-blog   文件: AbstractApplication.java
protected static void abstractMain(SpringApplication app, String[] args) throws UnknownHostException {
    SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
    addDefaultProfile(app, source);
    //addLiquibaseScanPackages();
    staticEnv = app.run(args).getEnvironment();
    showAppInfo(staticEnv);
}
 
源代码18 项目: huanhuan-blog   文件: AbstractApplication.java
/**
 * If no profile has been configured, set by default the "dev" profile.
 */
protected static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if ((System.getProperty("spring.profiles.active") == null)
            && !source.containsProperty("spring.profiles.active")
            && !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {
        app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
    }
}
 
源代码19 项目: gpmr   文件: GpmrApp.java
/**
 * If no profile has been configured, set by default the "dev" profile.
 */
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active") &&
        !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {

        app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
    }
}
 
protected static void abstractMain(SpringApplication app, String[] args) throws UnknownHostException {
    SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
    addDefaultProfile(app, source);
    //addLiquibaseScanPackages();
    staticEnv = app.run(args).getEnvironment();
    showAppInfo(staticEnv);
}
 
/**
 * If no profile has been configured, set by default the "dev" profile.
 */
protected static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if ((System.getProperty("spring.profiles.active") == null)
            && !source.containsProperty("spring.profiles.active")
            && !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {
        app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
    }
}
 
源代码22 项目: todo-spring-angular   文件: Application.java
/**
 * Main method, used to run the application.
 */
public static void main(String[] args) throws UnknownHostException {
    SpringApplication app = new SpringApplication(Application.class);
    SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
    addDefaultProfile(app, source);
    Environment env = app.run(args).getEnvironment();
    log.info("Access URLs:\n----------------------------------------------------------\n\t" +
            "Local: \t\thttp://127.0.0.1:{}\n\t" +
            "External: \thttp://{}:{}\n----------------------------------------------------------",
        env.getProperty("server.port"),
        InetAddress.getLocalHost().getHostAddress(),
        env.getProperty("server.port"));
}
 
源代码23 项目: todo-spring-angular   文件: Application.java
/**
 * If no profile has been configured, set by default the "dev" profile.
 */
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active") &&
        !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {

        app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
    }
}
 
/**
 * If no profile has been configured, set by default the "dev" profile.
 */
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active") &&
            !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {

        app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
    }
}
 
源代码25 项目: ServiceCutter   文件: Application.java
/**
 * If no profile has been configured, set by default the "dev" profile.
 */
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active") &&
            !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {

        app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
    }
}
 
源代码26 项目: msf4j   文件: MSF4JSpringApplication.java
protected ConfigurableApplicationContext run(boolean doRefresh, String... args) {
    ConfigurableApplicationContext context = createApplicationContext();
    if (configurationClass != null) {
        registerIfAnnotationConfigApplicationContext(context);
    } else {
        scanIfAnnotationConfigApplicationContext(context);
    }

    context.getEnvironment().getPropertySources().addFirst(new SimpleCommandLinePropertySource(args));

    if (doRefresh) {
        context.refresh();
    }
    return context;
}
 
源代码27 项目: expper   文件: Application.java
/**
 * Main method, used to run the application.
 */
public static void main(String[] args) throws UnknownHostException {
    SpringApplication app = new SpringApplication(Application.class);
    SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
    addDefaultProfile(app, source);
    Environment env = app.run(args).getEnvironment();
    log.info("Access URLs:\n----------------------------------------------------------\n\t" +
            "Local: \t\thttp://127.0.0.1:{}\n\t" +
            "External: \thttp://{}:{}\n----------------------------------------------------------",
        env.getProperty("server.port"),
        InetAddress.getLocalHost().getHostAddress(),
        env.getProperty("server.port"));

}
 
源代码28 项目: expper   文件: Application.java
/**
 * If no profile has been configured, set by default the "dev" profile.
 */
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active") &&
            !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {

        app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
    }
}
 
源代码29 项目: liiklus   文件: Application.java
public static SpringApplication createSpringApplication(String[] args) {
    var environment = new StandardEnvironment();
    environment.setDefaultProfiles("exporter", "gateway");
    environment.getPropertySources().addFirst(new SimpleCommandLinePropertySource(args));

    var pluginsDir = environment.getProperty("plugins.dir", String.class, "./plugins");
    var pathMatcher = environment.getProperty("plugins.pathMatcher", String.class, "*.jar");

    var pluginsRoot = Paths.get(pluginsDir).toAbsolutePath().normalize();
    log.info("Loading plugins from '{}' with matcher: '{}'", pluginsRoot, pathMatcher);

    var pluginManager = new LiiklusPluginManager(pluginsRoot, pathMatcher);

    pluginManager.loadPlugins();
    pluginManager.startPlugins();

    var binder = Binder.get(environment);
    var application = new SpringApplication(Application.class) {
        @Override
        protected void load(ApplicationContext context, Object[] sources) {
            // We don't want the annotation bean definition reader
        }
    };
    application.setWebApplicationType(WebApplicationType.REACTIVE);
    application.setApplicationContextClass(ReactiveWebServerApplicationContext.class);
    application.setEnvironment(environment);

    application.addInitializers(
            new StringCodecInitializer(false, true),
            new ResourceCodecInitializer(false),
            new ReactiveWebServerInitializer(
                    binder.bind("server", ServerProperties.class).orElseGet(ServerProperties::new),
                    binder.bind("spring.resources", ResourceProperties.class).orElseGet(ResourceProperties::new),
                    binder.bind("spring.webflux", WebFluxProperties.class).orElseGet(WebFluxProperties::new),
                    new NettyReactiveWebServerFactory()
            ),
            new GatewayConfiguration(),
            (GenericApplicationContext applicationContext) -> {
                applicationContext.registerBean("health", RouterFunction.class, () -> {
                    return RouterFunctions.route()
                            .GET("/health", __ -> ServerResponse.ok().bodyValue("OK"))
                            .build();
                });

                applicationContext.registerBean(PluginManager.class, () -> pluginManager);
            }
    );

    application.addInitializers(
            pluginManager.getExtensionClasses(ApplicationContextInitializer.class).stream()
                    .map(it -> {
                        try {
                            return it.getDeclaredConstructor().newInstance();
                        } catch (Exception e) {
                            throw new RuntimeException(e);
                        }
                    })
                    .toArray(ApplicationContextInitializer[]::new)
    );

    return application;
}
 
源代码30 项目: seed   文件: OpenRun.java
public static void main(String[] args) {
    new SpringApplicationBuilder().sources(OpenRun.class).profiles(getProfile(new SimpleCommandLinePropertySource(args))).run(args);
}