限制条件:
the default script supports most linux distributions and is tested on centos and ubuntu. other platforms, such as os x and freebsd, will require the use of a custom embeddedlaunchscript.
当前文档适用于 centos and ubuntu,其他平台需要定制脚本
1、部署发布
1.1 打包
maven打包成执行文件
<plugin> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-maven-plugin</artifactid> <configuration> <executable>true</executable> </configuration> </plugin>
gradle设置
springboot { executable = true }
you can then run your application by typing ./my-application.jar (where my-application is the name of your artifact).
打包完成后,可以使用./my-application.jar 运行
1.2 原理
linux下查看文件格式为一个bshell可执行文件
[root@i-2cjt6k6n ~]# file audit-console-1.0.0.jar audit-console-1.0.0.jar: bourne-again shell script text executable
查看文件内容
vi audit-console-1.0.0.jar
文件开头:
shell与执行jar内容的分割:
可以看到,非常高的技巧,jar包包装为shell可执行文件,另外可以加载自己运行
1.3 发布为一个服务
ln -s /var/myapp/myapp.jar /etc/init.d/myapp service myapp start
总结
以上所述是小编给大家介绍的spring boot部署发布到linux的操作方法,希望对大家有所帮助
如对本文有疑问, 点击进行留言回复!!
ScrollView和RecyclerView的滑动事件处理
配置JAVA环境+安装Android Studio全过程+踩坑记录
Android P Camera2当SD卡被拔出来自动切换到内部存储
android 多个edittext 判空监听 让Button动态是否可点击
Android开源项目滚轮选择器WheelPicker的基本用法总结
网友评论