zoukankan      html  css  js  c++  java
  • Spring Boot程序接收命令行参数

    Spring Boot程序接收命令行参数

    输入一行,回车,触发一次。如果想要调用service层,也是可以,能调用service层,就可以做很多事,触发一次就好比调用了一次http接口一样

    package com.aircas.satellitemanagement;
    
    import com.aircas.satellitemanagement.station.service.PlanFileService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.boot.CommandLineRunner;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.boot.web.servlet.ServletComponentScan;
    import org.springframework.context.ApplicationContext;
    
    import java.util.Scanner;
    
    @SpringBootApplication
    @ServletComponentScan
    public class SatelliteManagementApplication implements CommandLineRunner {
    
        @Autowired
        PlanFileService planFileService;
    
        public static void main(String[] args) {
            SpringApplication.run(SatelliteManagementApplication.class, args);
    
        }
    
        @Override
        public void run(String... args) {
            Scanner scanner = new Scanner(System.in);
            while (scanner.hasNext()) {
                String s = scanner.nextLine();
                System.out.println("test::::::" + s);
                planFileService.getAllPlanFile();
            }
    
        }
    }
  • 相关阅读:
    建立十字链表
    KMP算法
    魔术师发牌问题(循环链表)
    约瑟夫问题(循环链表)
    中缀表达式 转 (逆)波兰表达式
    中缀表达式求值
    迷宫问题(回溯法)
    范数
    AUC
    概率论
  • 原文地址:https://www.cnblogs.com/myfrank/p/14160701.html
Copyright © 2011-2022 走看看