(1) The jar is not an executable JAR. Using java-jar xxx.jar, you will find the same problem:

(2) Add spring-boot-Maven-plugin to project POM file:

<plugins>
    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>
</plugins>
Copy the code

The Spring Boot Maven Plugin can package a Spring Boot application as an executable JAR or WAR file, and then run the Spring Boot application in the usual way. The default goal is repackage.