org.springframework.boot.ApplicationArguments

Here are the examples of the java api org.springframework.boot.ApplicationArguments taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

279 Examples 7

19 View Source File : InitApplicationRunner.java
License : MIT License
Project Creator : zzzzbw

@Transactional(rollbackFor = Throwable.clreplaced)
@Override
public void run(ApplicationArguments args) throws Exception {
    log.info("Initializing Fame after springboot loading completed...");
    long startTime = System.currentTimeMillis();
    boolean isInit = optionService.get(OptionKeys.FAME_INIT, Boolean.FALSE);
    if (!isInit) {
        createDefaultIfAbsent();
    }
    initDispatcherServlet();
    log.info("Fame initialization in " + (System.currentTimeMillis() - startTime) + " ms");
}

19 View Source File : TaskRunner.java
License : GNU General Public License v2.0
Project Creator : ZoeShaw101

@Override
public void run(ApplicationArguments var) throws Exception {
    while (true) {
        // 进程内队列
        SuccessKilled kill = SeckillQueue.getMailQueue().consume();
        if (kill != null) {
            seckillService.startSeckil(kill.getSeckillId(), kill.getUserId());
        }
    }
}

19 View Source File : TimerMangerRunner.java
License : Apache License 2.0
Project Creator : zhuoqianmingyue

@Override
public void run(ApplicationArguments args) throws Exception {
    // TimerManger manger = new TimerManger(new DemoTask());
    // manger.run();
    ScheduledExecutorTest test = new ScheduledExecutorTest(new ScheduledExecutorTask());
    test.run();
}

19 View Source File : SecondApplicationRunner.java
License : GNU General Public License v3.0
Project Creator : zhonghuasheng

@Override
public void run(ApplicationArguments args) throws Exception {
    System.out.println("SecondApplicationRunner order=2");
}

19 View Source File : FirstApplicationRunner.java
License : GNU General Public License v3.0
Project Creator : zhonghuasheng

@Override
public void run(ApplicationArguments args) throws Exception {
    System.out.println("FirstApplicationRunner order=1");
}

19 View Source File : DatabaseLoader.java
License : Apache License 2.0
Project Creator : zhcet-amu

@Override
public void run(ApplicationArguments args) throws Exception {
    log.debug("Running DatabaseLoader");
    log.debug("Currently, no task to run");
}

19 View Source File : BlogApplicationRunner.java
License : MIT License
Project Creator : zhangyd-c

@Override
public void run(ApplicationArguments applicationArguments) {
    log.info("程序部署完成,访问地址:http://localhost:" + port);
}

19 View Source File : TaskRunner.java
License : GNU General Public License v3.0
Project Creator : zhangyd-c

@Override
public void run(ApplicationArguments args) {
    articleLookTask.save();
}

19 View Source File : BlogApplicationRunner.java
License : GNU General Public License v3.0
Project Creator : zhangyd-c

@Override
public void run(ApplicationArguments applicationArguments) {
    log.info("博客部署完成,博客访问地址:http://localhost:" + port);
}

19 View Source File : GreetingApplicationRunner.java
License : MIT License
Project Creator : y0ngb1n

@Override
public void run(ApplicationArguments args) throws Exception {
    log.info("Hello everyone! We all like Spring!");
}

19 View Source File : InitData.java
License : Apache License 2.0
Project Creator : Xiao-Y

@Override
public void run(ApplicationArguments args) throws Exception {
    this.initRouteInfo();
}

19 View Source File : EmbeddedRedis.java
License : MIT License
Project Creator : xbox1994

@Override
public void run(ApplicationArguments applicationArguments) {
    redisServer = RedisServer.builder().port(63799).setting("bind 127.0.0.1").setting("requirepreplaced test").build();
    redisServer.start();
}

19 View Source File : PrintRunner.java
License : MIT License
Project Creator : wuyouzhuguli

@Override
public void run(ApplicationArguments args) {
    logger.info("Provided by handsome 帅比裙主,详情见readme.md");
}

19 View Source File : HelloApplicationRunner.java
License : MIT License
Project Creator : wuyouzhuguli

@Override
public void run(ApplicationArguments args) {
    System.out.println("HelloApplicationRunner: hello spring boot");
}

19 View Source File : Launcher.java
License : GNU Affero General Public License v3.0
Project Creator : wolfiabot

@Override
public void run(final ApplicationArguments args) throws Exception {
    this.poolMetrics.addPool("restActions", (ScheduledThreadPoolExecutor) RestActions.restService);
    this.botStatusLogger.log(Emojis.ROCKET, "Starting...");
    if (this.wolfiaConfig.isDebug())
        log.info("Running DEBUG configuration");
    else
        log.info("Running PRODUCTION configuration");
    while (!allShardsUp()) {
        Thread.sleep(100);
    }
    this.botStatusLogger.log(Emojis.ONE_HUNDRED, "All shards connected!");
}

19 View Source File : InitServlet.java
License : Apache License 2.0
Project Creator : weizhiqiang1995

@Override
public void run(ApplicationArguments arg0) throws Exception {
    String basePath = InitServlet.clreplaced.getClreplacedLoader().getResource("./").getPath();
    String[] filePath = REQUEST_URL.split(",");
    REQUEST_URL = "";
    for (String str : filePath) {
        if (!ToolUtil.isBlank(str)) {
            REQUEST_URL = REQUEST_URL + basePath + str + ",";
        }
    }
    // 启动线程读取配置文件
    new Thread(new TokenThread(REQUEST_URL)).start();
    log.info("启动线程读取配置文件成功");
}

19 View Source File : InitServlet.java
License : Apache License 2.0
Project Creator : weizhiqiang1995

@Override
public void run(ApplicationArguments arg0) throws Exception {
    // 启动线程读取配置文件
    new Thread(new TokenThread(REQUEST_URL)).start();
    log.info("启动线程读取配置文件成功");
}

19 View Source File : CrawlApplicationRunner.java
License : Apache License 2.0
Project Creator : WeBankFinTech

@Override
public void run(ApplicationArguments var1) throws InterruptedException {
    if (systemEnvironmentConfig.getCrawlBatchUnit() < 1) {
        log.error("The batch unit threshold can't be less than 1!!");
        System.exit(1);
    }
    handle();
}

19 View Source File : GenerateCodeApplicationRunner.java
License : Apache License 2.0
Project Creator : WeBankFinTech

@Override
public void run(ApplicationArguments var1) throws Exception {
    log.info("Begin to generate code.");
    codeGenerateService.generateBee();
    log.info("Code generation Finished!");
    Runtime.getRuntime().exit(0);
}

19 View Source File : AppInitialization.java
License : Apache License 2.0
Project Creator : wang153723482

@Override
public void run(ApplicationArguments applicationArguments) throws Exception {
    // 检测jmeter运行环境
    checkJmeterHome();
    // 检测数据库
    checkDB();
}

19 View Source File : VisitsInitialization.java
License : Apache License 2.0
Project Creator : vip-efactory

@Override
public void run(ApplicationArguments args) {
    System.out.println("--------------- 初始化站点统计,如果存在今日统计则跳过 ---------------");
    visitsService.save();
    System.out.println("--------------- 初始化站点统计完成 ---------------");
}

19 View Source File : MyApplicationRunner.java
License : MIT License
Project Creator : veneris

@Override
public void run(ApplicationArguments args) throws Exception {
    initAppId();
}

19 View Source File : NacosConfigRunner.java
License : Apache License 2.0
Project Creator : ukihsoroy

@Override
public void run(ApplicationArguments args) throws Exception {
    System.out.println(String.format("Initial name=%s, age=%d", name, age));
    nacosConfigProperties.configServiceInstance().addListener("nacos-config-example.properties", "DEFAULT_GROUP", new Listener() {

        /**
         * Callback with latest config data.
         *
         * For example, config data in Nacos is:
         *
         * user.name=Nacos user.age=25
         *
         * @param configInfo latest config data for specific dataId in Nacos
         * server
         */
        @Override
        public void receiveConfigInfo(String configInfo) {
            Properties properties = new Properties();
            try {
                properties.load(new StringReader(configInfo));
            } catch (IOException e) {
                e.printStackTrace();
            }
            System.out.println("config changed: " + properties);
        }

        @Override
        public Executor getExecutor() {
            return null;
        }
    });
}

19 View Source File : HelloApplicationRunner.java
License : Apache License 2.0
Project Creator : u014427391

@Override
public void run(ApplicationArguments args) throws Exception {
    System.out.println("ApplicationRunner...run....");
}

19 View Source File : ChaosEngine.java
License : Apache License 2.0
Project Creator : ThalesGroup

public static void restart() {
    ApplicationArguments args = context.getBean(ApplicationArguments.clreplaced);
    Thread thread = new Thread(() -> {
        context.close();
        SpringApplication app;
        app = new SpringApplication(ChaosEngine.clreplaced);
        app.setBannerMode(Banner.Mode.OFF);
        context = app.run(args.getSourceArgs());
    });
    thread.setDaemon(false);
    thread.start();
}

19 View Source File : Application.java
License : Apache License 2.0
Project Creator : syndesisio

@Override
@SuppressFBWarnings("DM_EXIT")
public void run(ApplicationArguments args) {
    try {
        // NOPMD
        System.out.println("To: " + to);
        generateIntegrationProject(new File(to));
    } catch (IOException e) {
        // NOPMD
        e.printStackTrace();
        // NOPMD
        System.exit(1);
    }
}

19 View Source File : QuartzApplicationRunner.java
License : Apache License 2.0
Project Creator : suxiongwei

@Override
public void run(ApplicationArguments args) throws Exception {
    quartzService.buildPushTimer();
}

19 View Source File : Application.java
License : GNU General Public License v3.0
Project Creator : straumat

@Override
public final void run(final ApplicationArguments args) {
    // If it's a benchmark.
    if (args.containsOption(BENCHMARK_PARAMETER)) {
        final ExecutorService service = Executors.newSingleThreadExecutor();
        service.execute(benchmarkLauncher);
    } else {
        log.info("Application will start importing data in few minutes");
    }
}

19 View Source File : GrayClientApplicationRunner.java
License : Apache License 2.0
Project Creator : SpringCloud

@Override
public void run(ApplicationArguments args) throws Exception {
    loadLocalInstanceInfo();
    loadHooks();
    loadDefaultTrackDefinitions();
    log.info("开始装载灰度...");
    initializeGrayInfos();
    log.info("灰度装载完成.");
    executeStartHooks();
}

19 View Source File : SampleRunner.java
License : Apache License 2.0
Project Creator : spring-projects-experimental

@Override
public void run(ApplicationArguments args) throws Exception {
    this.logger.info("ApplicationRunner is executed.");
}

19 View Source File : CommandProcessor.java
License : Apache License 2.0
Project Creator : spring-io

@Override
public void run(ApplicationArguments args) throws IOException {
    run(args.getNonOptionArgs());
}

19 View Source File : CheckCommand.java
License : Apache License 2.0
Project Creator : spring-io

@Override
public void run(ApplicationArguments args) throws Exception {
    CheckRequest request = this.systemInput.read(CheckRequest.clreplaced);
    CheckResponse response = this.handler.handle(request);
    this.systemOutput.write(response);
}

19 View Source File : FunctionDeployerConfiguration.java
License : Apache License 2.0
Project Creator : spring-cloud

@Bean
SmartLifecycle functionArchiveUnDeployer(FunctionDeployerProperties functionProperties, FunctionRegistry functionRegistry, ApplicationArguments arguments, @Nullable MavenProperties mavenProperties) {
    ApplicationArguments updatedArguments = this.updateArguments(arguments);
    Archive archive = null;
    try {
        File file;
        String location = functionProperties.getLocation();
        replacedert.hasText(location, "`spring.cloud.function.location` property must be defined.");
        if (location.startsWith("maven://")) {
            MavenResourceLoader resourceLoader = new MavenResourceLoader(mavenProperties);
            file = resourceLoader.getResource(location).getFile();
        } else {
            file = new File(location);
        }
        if (!file.exists()) {
            throw new IllegalStateException("Failed to create archive: " + functionProperties.getLocation() + " does not exist");
        } else if (file.isDirectory()) {
            archive = new ExplodedArchive(file);
        } else {
            archive = new JarFileArchive(file);
        }
    } catch (IOException e) {
        throw new IllegalStateException("Failed to create archive: " + functionProperties.getLocation(), e);
    }
    FunctionArchiveDeployer deployer = new FunctionArchiveDeployer(archive);
    if (logger.isInfoEnabled()) {
        logger.info("Deploying archive: " + functionProperties.getLocation());
    }
    deployer.deploy(functionRegistry, functionProperties, updatedArguments.getSourceArgs());
    if (logger.isInfoEnabled()) {
        logger.info("Successfully deployed archive: " + functionProperties.getLocation());
    }
    return new SmartLifecycle() {

        private boolean running = true;

        @Override
        public void stop() {
            if (logger.isInfoEnabled()) {
                logger.info("Undeploying archive: " + functionProperties.getLocation());
            }
            deployer.undeploy();
            if (logger.isInfoEnabled()) {
                logger.info("Successfully undeployed archive: " + functionProperties.getLocation());
            }
            this.running = false;
        }

        @Override
        public void start() {
        // no op
        }

        @Override
        public boolean isRunning() {
            return this.running;
        }

        @Override
        public int getPhase() {
            return Integer.MAX_VALUE - 1000;
        }
    };
}

19 View Source File : FunctionDeployerConfiguration.java
License : Apache License 2.0
Project Creator : spring-cloud

/*
	 * We need to update the actual arguments with non-legacy properties before preplaceding these arguments to the deployable archive.
	 * For the current application FunctionProperties already updated and set as a result of EnvironmentPostProcessor
	 */
private ApplicationArguments updateArguments(ApplicationArguments arguments) {
    List<String> originalArguments = new ArrayList<String>(Arrays.asList(arguments.getSourceArgs()));
    if (arguments.containsOption("function.name")) {
        originalArguments.add(FunctionProperties.PREFIX + ".definition=" + arguments.getOptionValues("function.name").get(0));
    }
    if (arguments.containsOption("function.location")) {
        originalArguments.add(FunctionProperties.PREFIX + ".location=" + arguments.getOptionValues("function.location").get(0));
    }
    ApplicationArguments updatedArguments = new DefaultApplicationArguments(originalArguments.toArray(new String[] {}));
    return updatedArguments;
}

19 View Source File : DataLoaderConfig.java
License : MIT License
Project Creator : SourceLabOrg

/**
 * Run on startup.
 */
@Override
public void run(final ApplicationArguments args) throws Exception {
    createData();
}

19 View Source File : ApplicationWithTaskExecutionBackoff.java
License : Apache License 2.0
Project Creator : sonus21

public static void restart() {
    ApplicationArguments args = context.getBean(ApplicationArguments.clreplaced);
    Thread thread = new Thread(() -> {
        context.close();
        context = SpringApplication.run(Application.clreplaced, args.getSourceArgs());
    });
    thread.setContextClreplacedLoader(mainThreadClreplacedLoader);
    thread.setDaemon(false);
    thread.start();
}

19 View Source File : ApplicationStartup.java
License : Apache License 2.0
Project Creator : RudeCrab

@Override
public void run(ApplicationArguments args) throws Exception {
    // 扫描并获取所有需要权限处理的接口资源(该方法逻辑写在下面)
    List<Resource> list = getAuthResources();
    // 先删除所有操作权限类型的权限资源,待会再新增资源,以实现全量更新(注意哦,数据库中不要设置外键,否则会删除失败)
    resourceService.deleteResourceByType(1);
    // 如果权限资源为空,就不用走后续数据插入步骤
    if (Collections.isEmpty(list)) {
        return;
    }
    // 将权限资源给放到权限缓存里
    MySecurityMetadataSource.getRESOURCES().addAll(list);
    // 将资源数据批量添加到数据库
    resourceService.insertResources(list);
}

19 View Source File : ApplicationStartup.java
License : Apache License 2.0
Project Creator : RudeCrab

@Override
public void run(ApplicationArguments args) throws Exception {
    // 扫描并获取所有需要权限处理的接口资源(该方法逻辑写在下面)
    List<Resource> list = getAuthResources();
    // 先删除所有操作权限类型的权限资源,待会再新增资源,以实现全量更新(注意哦,数据库中不要设置外键,否则会删除失败)
    resourceService.deleteResourceByType(1);
    // 如果权限资源为空,就不用走后续数据插入步骤
    if (Collections.isEmpty(list)) {
        return;
    }
    // 将资源数据批量添加到数据库
    resourceService.insertResources(list);
}

19 View Source File : HelloApplicationRunner.java
License : MIT License
Project Creator : rickding

@Override
public void run(ApplicationArguments args) throws Exception {
    System.out.println("Hello application runner!");
}

19 View Source File : SecondApplicationRunner.java
License : MIT License
Project Creator : rexlin600

/**
 * Run *
 *
 * @param args args
 * @throws Exception exception
 */
@Override
public void run(ApplicationArguments args) throws Exception {
    log.info("==>  ApplicationRunner start " + this.getClreplaced().getName() + " , args=[" + args + "] ...");
}

19 View Source File : ContextStartup.java
License : GNU General Public License v3.0
Project Creator : qiushi123

@Override
public void run(ApplicationArguments applicationArguments) throws Exception {
    log.info("initialization ...");
    reloadOptions(true);
    resetChannels();
    log.info("OK, completed");
}

19 View Source File : WebsocketBridge.java
License : MIT License
Project Creator : puzzle

private void initArguments(ApplicationArguments args) {
    logger.info("Application started with command-line arguments: {}", Arrays.toString(args.getSourceArgs()));
    logger.info("NonOptionArgs: {}", args.getNonOptionArgs());
    logger.info("OptionNames: {}", args.getOptionNames());
    logger.info("Application started with command-line arguments: {}", Arrays.toString(args.getSourceArgs()));
    logger.info("NonOptionArgs: {}", args.getNonOptionArgs());
    logger.info("OptionNames: {}", args.getOptionNames());
    if (args.getOptionValues(OPTION_ARG_URL) != null && !args.getOptionValues(OPTION_ARG_URL).equals("")) {
        url = args.getOptionValues(OPTION_ARG_URL).get(0);
    } else if (System.getenv(ENV_URL) != null && !System.getenv(ENV_URL).equals("")) {
        url = System.getenv(ENV_URL);
    }
    if (args.getOptionValues(OPTION_ARG_TOPIC) != null && !args.getOptionValues(OPTION_ARG_TOPIC).equals("")) {
        topic = args.getOptionValues(OPTION_ARG_TOPIC).get(0);
    } else if (System.getenv(ENV_TOPIC) != null && !System.getenv(ENV_TOPIC).equals("")) {
        topic = System.getenv(ENV_TOPIC);
    }
    if (args.getOptionValues(OPTION_ARG_COMMAND) != null && !args.getOptionValues(OPTION_ARG_COMMAND).equals("")) {
        command = args.getOptionValues(OPTION_ARG_COMMAND).get(0);
    } else if (System.getenv(ENV_COMMAND) != null && !System.getenv(ENV_COMMAND).equals("")) {
        command = System.getenv(ENV_COMMAND);
    }
    if (args.getOptionValues(OPTION_ARG_MEMO_PREFIX) != null && !args.getOptionValues(OPTION_ARG_MEMO_PREFIX).equals("")) {
        memoPrefix = args.getOptionValues(OPTION_ARG_MEMO_PREFIX).get(0);
    } else if (System.getenv(ENV_MEMO_PREFIX) != null && !System.getenv(ENV_MEMO_PREFIX).equals("")) {
        memoPrefix = System.getenv(ENV_MEMO_PREFIX);
    }
}

19 View Source File : GatewayInitRunner.java
License : Apache License 2.0
Project Creator : pnoker

@Override
public void run(ApplicationArguments args) throws Exception {
}

19 View Source File : DataInitRunner.java
License : Apache License 2.0
Project Creator : pnoker

@Override
public void run(ApplicationArguments args) throws Exception {
    scheduleService.initial();
}

19 View Source File : PhoenixBeforeRunner.java
License : Apache License 2.0
Project Creator : PhoenixIQ

@Override
public void run(ApplicationArguments args) {
    log.info("phoenix starting...");
}

19 View Source File : PhoenixAfterRunner.java
License : Apache License 2.0
Project Creator : PhoenixIQ

@Override
public void run(ApplicationArguments args) {
    log.info("phoenix started");
}

19 View Source File : CodegenApplication.java
License : Apache License 2.0
Project Creator : penggle

@Override
public void run(ApplicationArguments args) throws Exception {
    System.out.println("========================================代码自动生成========================================");
}

19 View Source File : ZookeeperConsumerApplication.java
License : Apache License 2.0
Project Creator : paderlol

public void run(ApplicationArguments args) throws Exception {
    log.info(nacosDemoService.sayHello("This is from Nacos to Zookeeper Sync !"));
}

19 View Source File : NacosConsumerApplication.java
License : Apache License 2.0
Project Creator : paderlol

public void run(ApplicationArguments args) throws Exception {
    log.info(zookeeperDemoService.sayHello("This is from Zookeeper to Nacos Sync !"));
}

19 View Source File : ProductsAndReleasesTask.java
License : Apache License 2.0
Project Creator : pacphi

@Override
public void run(ApplicationArguments args) throws Exception {
    collect();
}

See More Examples