如何运行 spring boot jar

Aro*_*Raj 5 spring jar class execute spring-boot

我有弹簧启动罐。它包含 boot-inf 文件夹,该文件夹包含类和 lib 文件夹。我需要运行具有 main 方法的某个类。但我不知道如何运行它。对于普通 jar,我们可以使用以下格式从 jar 运行该类。

java -cp "sample.jar;dependecy.jar" com.sample.ClassName
Run Code Online (Sandbox Code Playgroud)

但是在 spring boot jar 中运行类的格式是什么。因为它包含 boot-inf 文件夹。我正在使用 gradle 脚本来构建项目

use*_*718 4

这应该很简单,只需:

java -jar sample.jar
Run Code Online (Sandbox Code Playgroud)

其中sample.jar是你的Spring Boot jar。

请参阅https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-running-your-application.html