指定主类Spring-Boot命令行 [英] Specify main class Spring-Boot command line

查看:119
本文介绍了指定主类Spring-Boot命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用maven插件来设置这样的主类:

I use maven plugin to set the main class like this :

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
    <mainClass>com.myapp.main.MainClass</mainClass>
</configuration>
</plugin>

但有时我想用另一个主类运行我的应用程序。执行此操作的命令行参数是什么?

But sometimes I want run my app with another main class. What is the command line arguments to do this?

java -jar myapp-1.0.jar ...

Thx

推荐答案

有一个发射器已经在Spring Boot中了。您需要使用它作为Main-Class构建jar(在构建配置中设置布局)。

There's a launcher for that in Spring Boot already. You need to build the jar with that as the Main-Class (by setting the layout in the build config).

这篇关于指定主类Spring-Boot命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆