在项目启动的时候需要做一些初始化的操作,比如初始化线程池,提前加载好加密证书等。为了达到这个目的,SpringBoot提供了ApplicationRunner接口和CommandLineRunner接口,这两个接口都有一个run()方法,在实现接口时需要覆盖该方法,不同之处在于ApplicationRunner的优先级大于CommandLineRunner,当然你可以给CommandLineRunner指定@Order(1)注解,使其优先级大于ApplicationRunner。
使ApplicationRunner接口与CommandLineRunner接口生效的方式有两种:
- 自定义类实现接口
主启动类实现接口 :::info 入参格式 ::: 启动参数的格式为
--name=liuyanntes空格--email==liuyanntes@163.com```java class SimpleCommandLineArgsParser {/**
- Parse the given {@code String} array based on the rules described {@linkplain
- SimpleCommandLineArgsParser above}, returning a fully-populated
- {@link CommandLineArgs} object.
- @param args command line arguments, typically from a {@code main()} method
*/
public CommandLineArgs parse(String… args) {
CommandLineArgs commandLineArgs = new CommandLineArgs();
for (String arg : args) {
} return commandLineArgs; }if (arg.startsWith("--")) {String optionText = arg.substring(2);String optionName;String optionValue = null;int indexOfEqualsSign = optionText.indexOf('=');if (indexOfEqualsSign > -1) {optionName = optionText.substring(0, indexOfEqualsSign);optionValue = optionText.substring(indexOfEqualsSign + 1);}else {optionName = optionText;}if (optionName.isEmpty()) {throw new IllegalArgumentException("Invalid argument syntax: " + arg);}commandLineArgs.addOptionArg(optionName, optionValue);}else {commandLineArgs.addNonOptionArg(arg);}
}
:::info自定义类实现接口:::自定义`TestApplicationRunner`实现`ApplicationRunner````javapackage com.example.demo.runner;import org.springframework.boot.ApplicationArguments;import org.springframework.boot.ApplicationRunner;import org.springframework.stereotype.Component;import java.util.Arrays;@Componentpublic class TestApplicationRunner implements ApplicationRunner {@Overridepublic void run(ApplicationArguments args) {System.out.println("===MyApplicationRunner===" + Arrays.asList(args.getSourceArgs()));System.out.println("===getOptionNames========" + args.getOptionNames());System.out.println("===name=======" + args.getOptionValues("name"));System.out.println("==email========" + args.getOptionValues("email"));}}
再创建一个TestCommandLineRunner实现CommandLineRunner
package com.example.demo.runner;import org.springframework.boot.CommandLineRunner;import org.springframework.stereotype.Component;import java.util.Arrays;@Componentpublic class TestCommandLineRunner implements CommandLineRunner {@Overridepublic void run(String... args) {System.out.println("===CommandLineRunner===" + Arrays.asList(args));}}
主启动类DemoApplication
package com.example.demo;import org.springframework.boot.CommandLineRunner;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import java.util.Arrays;@SpringBootApplicationpublic class DemoApplication{public static void main(String[] args) {SpringApplication.run(DemoApplication.class, args);System.out.println("主启动类结束");}}
启动日志
D:\App\java1.8\jdk\bin\java.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always "-javaagent:D:\App\IntelliJ IDEA 2020.3.1\lib\idea_rt.jar=58988:D:\App\IntelliJ IDEA 2020.3.1\bin" -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath D:\App\java1.8\jdk\jre\lib\charsets.jar;D:\App\java1.8\jdk\jre\lib\deploy.jar;D:\App\java1.8\jdk\jre\lib\ext\access-bridge-64.jar;D:\App\java1.8\jdk\jre\lib\ext\cldrdata.jar;D:\App\java1.8\jdk\jre\lib\ext\dnsns.jar;D:\App\java1.8\jdk\jre\lib\ext\jaccess.jar;D:\App\java1.8\jdk\jre\lib\ext\jfxrt.jar;D:\App\java1.8\jdk\jre\lib\ext\localedata.jar;D:\App\java1.8\jdk\jre\lib\ext\nashorn.jar;D:\App\java1.8\jdk\jre\lib\ext\sunec.jar;D:\App\java1.8\jdk\jre\lib\ext\sunjce_provider.jar;D:\App\java1.8\jdk\jre\lib\ext\sunmscapi.jar;D:\App\java1.8\jdk\jre\lib\ext\sunpkcs11.jar;D:\App\java1.8\jdk\jre\lib\ext\zipfs.jar;D:\App\java1.8\jdk\jre\lib\javaws.jar;D:\App\java1.8\jdk\jre\lib\jce.jar;D:\App\java1.8\jdk\jre\lib\jfr.jar;D:\App\java1.8\jdk\jre\lib\jfxswt.jar;D:\App\java1.8\jdk\jre\lib\jsse.jar;D:\App\java1.8\jdk\jre\lib\management-agent.jar;D:\App\java1.8\jdk\jre\lib\plugin.jar;D:\App\java1.8\jdk\jre\lib\resources.jar;D:\App\java1.8\jdk\jre\lib\rt.jar;D:\devspace\test\target\classes;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter-web\2.6.5\spring-boot-starter-web-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter\2.6.5\spring-boot-starter-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot\2.6.5\spring-boot-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-autoconfigure\2.6.5\spring-boot-autoconfigure-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter-logging\2.6.5\spring-boot-starter-logging-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\ch\qos\logback\logback-classic\1.2.11\logback-classic-1.2.11.jar;D:\devspace\apache-maven-3.3.9\myRepository\ch\qos\logback\logback-core\1.2.11\logback-core-1.2.11.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\logging\log4j\log4j-api\2.17.2\log4j-api-2.17.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;D:\devspace\apache-maven-3.3.9\myRepository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\yaml\snakeyaml\1.29\snakeyaml-1.29.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter-json\2.6.5\spring-boot-starter-json-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\core\jackson-databind\2.13.2\jackson-databind-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\core\jackson-annotations\2.13.2\jackson-annotations-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\core\jackson-core\2.13.2\jackson-core-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.2\jackson-datatype-jdk8-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.2\jackson-datatype-jsr310-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.2\jackson-module-parameter-names-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter-tomcat\2.6.5\spring-boot-starter-tomcat-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\tomcat\embed\tomcat-embed-core\9.0.60\tomcat-embed-core-9.0.60.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\tomcat\embed\tomcat-embed-el\9.0.60\tomcat-embed-el-9.0.60.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.60\tomcat-embed-websocket-9.0.60.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-web\5.3.17\spring-web-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-beans\5.3.17\spring-beans-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-webmvc\5.3.17\spring-webmvc-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-aop\5.3.17\spring-aop-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-context\5.3.17\spring-context-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-expression\5.3.17\spring-expression-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-core\5.3.17\spring-core-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-jcl\5.3.17\spring-jcl-5.3.17.jar com.example.demo.DemoApplication --name=liuyanntes --email==liuyanntes@163.com. ____ _ __ _ _/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/ ___)| |_)| | | | | || (_| | ) ) ) )' |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot :: (v2.6.5)2022-04-17 00:59:49.608 INFO 5576 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication using Java 1.8.0_202 on DESKTOP-13536KB with PID 5576 (D:\devspace\test\target\classes started by dell in D:\devspace\test)2022-04-17 00:59:49.608 INFO 5576 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: "default"2022-04-17 00:59:50.813 INFO 5576 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)2022-04-17 00:59:50.828 INFO 5576 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]2022-04-17 00:59:50.828 INFO 5576 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.60]2022-04-17 00:59:50.969 INFO 5576 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext2022-04-17 00:59:50.969 INFO 5576 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1267 ms2022-04-17 00:59:51.344 INFO 5576 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''2022-04-17 00:59:51.344 INFO 5576 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 2.272 seconds (JVM running for 3.351)===MyApplicationRunner===[--name=liuyanntes, --email==liuyanntes@163.com]===getOptionNames========[name, email]===name=======[liuyanntes]==email========[=liuyanntes@163.com]===CommandLineRunner===[--name=liuyanntes, --email==liuyanntes@163.com]主启动类结束
执行顺序为:
- 主程序启动
- 执行TestApplicationRunner.run,
- 执行TestCommandLineRunner.run,
- 主启动类结束
:::info
主启动类实现接口
:::
令主启动类
DemoApplication去实现TestApplicationRunner或者TestCommandLineRunner
主启动类实现ApplicationRunner: ```java package com.example.demo;
import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.util.Arrays;
@SpringBootApplication public class DemoApplication implements ApplicationRunner { //主类注释 //分支合并分支合并分支合并 public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); System.out.println(“主启动类结束”); }
@Overridepublic void run(ApplicationArguments args) throws Exception {System.out.println("这是重写的启动类run方法"+ Arrays.asList(args));System.out.println("===MyApplicationRunner===" + Arrays.asList(args.getSourceArgs()));System.out.println("===getOptionNames========" + args.getOptionNames());System.out.println("===name=======" + args.getOptionValues("name"));System.out.println("==email========" + args.getOptionValues("email"));}
}
启动日志: D:\App\java1.8\jdk\bin\java.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always “-javaagent:D:\App\IntelliJ IDEA 2020.3.1\lib\idea_rt.jar=59676:D:\App\IntelliJ IDEA 2020.3.1\bin” -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath D:\App\java1.8\jdk\jre\lib\charsets.jar;D:\App\java1.8\jdk\jre\lib\deploy.jar;D:\App\java1.8\jdk\jre\lib\ext\access-bridge-64.jar;D:\App\java1.8\jdk\jre\lib\ext\cldrdata.jar;D:\App\java1.8\jdk\jre\lib\ext\dnsns.jar;D:\App\java1.8\jdk\jre\lib\ext\jaccess.jar;D:\App\java1.8\jdk\jre\lib\ext\jfxrt.jar;D:\App\java1.8\jdk\jre\lib\ext\localedata.jar;D:\App\java1.8\jdk\jre\lib\ext\nashorn.jar;D:\App\java1.8\jdk\jre\lib\ext\sunec.jar;D:\App\java1.8\jdk\jre\lib\ext\sunjce_provider.jar;D:\App\java1.8\jdk\jre\lib\ext\sunmscapi.jar;D:\App\java1.8\jdk\jre\lib\ext\sunpkcs11.jar;D:\App\java1.8\jdk\jre\lib\ext\zipfs.jar;D:\App\java1.8\jdk\jre\lib\javaws.jar;D:\App\java1.8\jdk\jre\lib\jce.jar;D:\App\java1.8\jdk\jre\lib\jfr.jar;D:\App\java1.8\jdk\jre\lib\jfxswt.jar;D:\App\java1.8\jdk\jre\lib\jsse.jar;D:\App\java1.8\jdk\jre\lib\management-agent.jar;D:\App\java1.8\jdk\jre\lib\plugin.jar;D:\App\java1.8\jdk\jre\lib\resources.jar;D:\App\java1.8\jdk\jre\lib\rt.jar;D:\devspace\test\target\classes;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter-web\2.6.5\spring-boot-starter-web-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter\2.6.5\spring-boot-starter-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot\2.6.5\spring-boot-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-autoconfigure\2.6.5\spring-boot-autoconfigure-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter-logging\2.6.5\spring-boot-starter-logging-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\ch\qos\logback\logback-classic\1.2.11\logback-classic-1.2.11.jar;D:\devspace\apache-maven-3.3.9\myRepository\ch\qos\logback\logback-core\1.2.11\logback-core-1.2.11.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\logging\log4j\log4j-api\2.17.2\log4j-api-2.17.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;D:\devspace\apache-maven-3.3.9\myRepository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\yaml\snakeyaml\1.29\snakeyaml-1.29.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter-json\2.6.5\spring-boot-starter-json-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\core\jackson-databind\2.13.2\jackson-databind-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\core\jackson-annotations\2.13.2\jackson-annotations-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\core\jackson-core\2.13.2\jackson-core-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.2\jackson-datatype-jdk8-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.2\jackson-datatype-jsr310-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.2\jackson-module-parameter-names-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter-tomcat\2.6.5\spring-boot-starter-tomcat-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\tomcat\embed\tomcat-embed-core\9.0.60\tomcat-embed-core-9.0.60.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\tomcat\embed\tomcat-embed-el\9.0.60\tomcat-embed-el-9.0.60.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.60\tomcat-embed-websocket-9.0.60.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-web\5.3.17\spring-web-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-beans\5.3.17\spring-beans-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-webmvc\5.3.17\spring-webmvc-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-aop\5.3.17\spring-aop-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-context\5.3.17\spring-context-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-expression\5.3.17\spring-expression-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-core\5.3.17\spring-core-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-jcl\5.3.17\spring-jcl-5.3.17.jar com.example.demo.DemoApplication —name=liuyanntes —email==liuyanntes@163.com
. _ /\ / ‘ () \ \ \ \ ( ( )__ | ‘ | ‘| | ‘ \/ ` | \ \ \ \ \/ )| |)| | | | | || (| | ) ) ) ) ‘ |_| .|| ||| |\, | / / / / =========||==============|__/=///_/ :: Spring Boot :: (v2.6.5)
2022-04-17 01:17:53.939 INFO 6812 —- [ main] com.example.demo.DemoApplication : Starting DemoApplication using Java 1.8.0_202 on DESKTOP-13536KB with PID 6812 (D:\devspace\test\target\classes started by dell in D:\devspace\test) 2022-04-17 01:17:53.943 INFO 6812 —- [ main] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: “default” 2022-04-17 01:17:55.260 INFO 6812 —- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2022-04-17 01:17:55.273 INFO 6812 —- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2022-04-17 01:17:55.274 INFO 6812 —- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.60] 2022-04-17 01:17:55.425 INFO 6812 —- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2022-04-17 01:17:55.425 INFO 6812 —- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1414 ms 2022-04-17 01:17:55.924 INFO 6812 —- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ‘’ 2022-04-17 01:17:55.936 INFO 6812 —- [ main] com.example.demo.DemoApplication : Started DemoApplication in 2.604 seconds (JVM running for 4.239) 这是重写的启动类run方法[org.springframework.boot.DefaultApplicationArguments@6dc1484] ===MyApplicationRunner===[—name=liuyanntes, —email==liuyanntes@163.com] ===getOptionNames========[name, email] ===name=======[liuyanntes] ==email========[=liuyanntes@163.com] 主启动类结束
主启动类实现`CommandLineRunner`:```javapackage com.example.demo;import org.springframework.boot.CommandLineRunner;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import java.util.Arrays;@SpringBootApplicationpublic class DemoApplication implements CommandLineRunner{//主类注释//分支合并分支合并分支合并public static void main(String[] args) {SpringApplication.run(DemoApplication.class, args);System.out.println("主启动类结束");}@Overridepublic void run(String... args) throws Exception {System.out.println("这是重写的启动类run方法"+ Arrays.asList(args));}}日志打印D:\App\java1.8\jdk\bin\java.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always "-javaagent:D:\App\IntelliJ IDEA 2020.3.1\lib\idea_rt.jar=59541:D:\App\IntelliJ IDEA 2020.3.1\bin" -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath D:\App\java1.8\jdk\jre\lib\charsets.jar;D:\App\java1.8\jdk\jre\lib\deploy.jar;D:\App\java1.8\jdk\jre\lib\ext\access-bridge-64.jar;D:\App\java1.8\jdk\jre\lib\ext\cldrdata.jar;D:\App\java1.8\jdk\jre\lib\ext\dnsns.jar;D:\App\java1.8\jdk\jre\lib\ext\jaccess.jar;D:\App\java1.8\jdk\jre\lib\ext\jfxrt.jar;D:\App\java1.8\jdk\jre\lib\ext\localedata.jar;D:\App\java1.8\jdk\jre\lib\ext\nashorn.jar;D:\App\java1.8\jdk\jre\lib\ext\sunec.jar;D:\App\java1.8\jdk\jre\lib\ext\sunjce_provider.jar;D:\App\java1.8\jdk\jre\lib\ext\sunmscapi.jar;D:\App\java1.8\jdk\jre\lib\ext\sunpkcs11.jar;D:\App\java1.8\jdk\jre\lib\ext\zipfs.jar;D:\App\java1.8\jdk\jre\lib\javaws.jar;D:\App\java1.8\jdk\jre\lib\jce.jar;D:\App\java1.8\jdk\jre\lib\jfr.jar;D:\App\java1.8\jdk\jre\lib\jfxswt.jar;D:\App\java1.8\jdk\jre\lib\jsse.jar;D:\App\java1.8\jdk\jre\lib\management-agent.jar;D:\App\java1.8\jdk\jre\lib\plugin.jar;D:\App\java1.8\jdk\jre\lib\resources.jar;D:\App\java1.8\jdk\jre\lib\rt.jar;D:\devspace\test\target\classes;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter-web\2.6.5\spring-boot-starter-web-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter\2.6.5\spring-boot-starter-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot\2.6.5\spring-boot-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-autoconfigure\2.6.5\spring-boot-autoconfigure-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter-logging\2.6.5\spring-boot-starter-logging-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\ch\qos\logback\logback-classic\1.2.11\logback-classic-1.2.11.jar;D:\devspace\apache-maven-3.3.9\myRepository\ch\qos\logback\logback-core\1.2.11\logback-core-1.2.11.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\logging\log4j\log4j-api\2.17.2\log4j-api-2.17.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;D:\devspace\apache-maven-3.3.9\myRepository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\yaml\snakeyaml\1.29\snakeyaml-1.29.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter-json\2.6.5\spring-boot-starter-json-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\core\jackson-databind\2.13.2\jackson-databind-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\core\jackson-annotations\2.13.2\jackson-annotations-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\core\jackson-core\2.13.2\jackson-core-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.2\jackson-datatype-jdk8-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.2\jackson-datatype-jsr310-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.2\jackson-module-parameter-names-2.13.2.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\boot\spring-boot-starter-tomcat\2.6.5\spring-boot-starter-tomcat-2.6.5.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\tomcat\embed\tomcat-embed-core\9.0.60\tomcat-embed-core-9.0.60.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\tomcat\embed\tomcat-embed-el\9.0.60\tomcat-embed-el-9.0.60.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.60\tomcat-embed-websocket-9.0.60.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-web\5.3.17\spring-web-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-beans\5.3.17\spring-beans-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-webmvc\5.3.17\spring-webmvc-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-aop\5.3.17\spring-aop-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-context\5.3.17\spring-context-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-expression\5.3.17\spring-expression-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-core\5.3.17\spring-core-5.3.17.jar;D:\devspace\apache-maven-3.3.9\myRepository\org\springframework\spring-jcl\5.3.17\spring-jcl-5.3.17.jar com.example.demo.DemoApplication --name=liuyanntes --email==liuyanntes@163.com. ____ _ __ _ _/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/ ___)| |_)| | | | | || (_| | ) ) ) )' |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot :: (v2.6.5)2022-04-17 01:14:19.875 INFO 492 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication using Java 1.8.0_202 on DESKTOP-13536KB with PID 492 (D:\devspace\test\target\classes started by dell in D:\devspace\test)2022-04-17 01:14:19.875 INFO 492 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: "default"2022-04-17 01:14:21.526 INFO 492 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)2022-04-17 01:14:21.542 INFO 492 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]2022-04-17 01:14:21.542 INFO 492 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.60]2022-04-17 01:14:21.697 INFO 492 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext2022-04-17 01:14:21.712 INFO 492 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1689 ms2022-04-17 01:14:22.103 INFO 492 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''2022-04-17 01:14:22.103 INFO 492 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 2.886 seconds (JVM running for 3.95)这是重写的启动类run方法[--name=liuyanntes, --email==liuyanntes@163.com]主启动类结束
