SpringBoot 创建 console程序
2021-07-02 17:05
标签:import 接口 代码 使用 frame end ati cat plugins 1.在pom中添加依赖 2.修改Application.java 使用实现接口CommandLineRunner SpringBoot 创建 console程序 标签:import 接口 代码 使用 frame end ati cat plugins 原文地址:https://www.cnblogs.com/liuxm2017/p/9629872.htmlparent>
groupId>org.springframework.bootgroupId>
artifactId>spring-boot-starterartifactId>
version>1.5.9.RELEASEversion>
parent>
dependencies>
dependency>
groupId>junitgroupId>
artifactId>junitartifactId>
version>4.11version>
scope>testscope>
dependency>
dependency>
groupId>org.springframework.bootgroupId>
artifactId>spring-boot-starterartifactId>
dependency>
dependencies>
build>
plugins>
plugin>
groupId>org.apache.maven.pluginsgroupId>
artifactId>maven-compiler-pluginartifactId>
configuration>
source>1.8source>
target>1.8target>
configuration>
plugin>
plugin>
groupId>org.springframework.bootgroupId>
artifactId>spring-boot-maven-pluginartifactId>
plugin>
plugins>
build>
修改Application.java 使用实现接口CommandLineRunner
package com.itstudy.springbootconsole;
import org.springframework.boot.Banner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(Application.class);
app.setBannerMode(Banner.Mode.OFF);
app.run(args);
}
public void run(String... arg0) throws Exception {
//这里添加代码
}
}
文章标题:SpringBoot 创建 console程序
文章链接:http://soscw.com/index.php/essay/100878.html