NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
# 1. 命令行参数问题 `jar -jar xx.jar [空格分隔的参数]` 这样执行jar问文件都会,传入到main方法的args参数 ~~~ @SpringBootApplication public class FilePathApplication { public static void main(String[] args){ SpringApplication.run(FilePathApplication.class, args); Arrays.stream(args).forEach(System.out::println); } } ~~~ 打成jar文件并执行 `java -jar filepath-1.0-SNAPSHOT.jar -Dspring.profiles.active=test hello --tett=param001` 输出如下: ``` -Dspring.profiles.active=test hello --tett=param001 ``` 无论输入什么样的参数,只要以空格分隔就满足条件,但是再springboot会对--tett=param001 和普通的参数进行区别封装(springboot启动时进行环境装配) ![](https://img.kancloud.cn/97/28/9728869584be80c7cfffbb1570fa2da6_853x630.png)