..

springboot非web应用

springboot使用方便,如果想使用springboot开发非web应用,只需要入口程序实现CommandLineRunner接口,Override run方法,即可。run方法为应用入口。

package com.bus.socketserver;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
public class SocketServerApplication implements CommandLineRunner {

    @SuppressWarnings("all")
    @Override
    public void run(String... args) throws Exception {
        System.in.read();
    }

    public static void main(String[] args) {
        SpringApplication.run(SocketServerApplication.class, args);
    }

}

 

posted @ 2020-08-22 09:28  罗浩楠  阅读(1528)  评论(0)    收藏  举报
..