How do I run a spring boot executable jar in a Production environment?

后端 未结 9 2149
一向
一向 2020-12-02 04:19

Spring boot\'s preferred deployment method is via a executable jar file which contains tomcat inside.

It is started with a simple java -jar myapp.jar.

9条回答
  •  误落风尘
    2020-12-02 04:54

    If you are using gradle you can just add this to your build.gradle

    springBoot {
        executable = true
    }
    

    You can then run your application by typing ./your-app.jar

    Also, you can find a complete guide here to set up your app as a service

    56.1.1 Installation as an init.d service (System V)

    http://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html

    cheers

提交回复
热议问题