Skip to content

Latest commit

 

History

History
46 lines (28 loc) · 1.27 KB

File metadata and controls

46 lines (28 loc) · 1.27 KB

cmd项目根目录

mvn -Pnexus spring-boot:run

运行spring-boot项目

mvn -Pnexus package

将sprint-boot项目打包

mvn spring-boot:run -Dlogging.level.root=warn -Drun.arguments="--name=Daniel"

关闭log信息并运行项目 后面--name是修改propereits的name属性

java -jar target\bt--SNAPSHOT.jar

运行jar包

##参数优先级

主要properties文件<外部properties文件<命令行参数

在application.properties中修改端口号

server.port=9999

启用spring-boot项目需要在main方法中使用

SpringApplication.run(当前类.class,args);

CommandLineRunner和ApplicationRunner

这两个是spring-boot的两个接口,都可以在web容器启动是执行。

比如:数据库连接,删除临时文件,清除缓存信息

不同点:ApplicationRunner中run方法的参数为ApplicationArguments,而CommandLineRunner接口中run方法的参数为String数组。

学习来源:csdn-【从零开始学Spring Boot】

##spring boot的junit

##processor 引入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>