简体   繁体   English

在一个 jar 中打包两个 spring boot 应用程序

[英]Pack two spring boot application in one jar

I have two different spring boot apps - client and server.我有两个不同的 Spring Boot 应用程序 - 客户端和服务器。 I use maven and pack this applications into two executable .jar files - client.jar and server.jar.我使用 maven 并将这个应用程序打包成两个可执行的 .jar 文件 - client.jar 和 server.jar。 It would be great to create one executable file (.jar or .exe) which would run this two applications sequentially - it would run server.jar first and then it would run client.jar, is it possible in a way?创建一个可以顺序运行这两个应用程序的可执行文件(.jar 或 .exe)会很棒 - 它会先运行 server.jar,然后运行 ​​client.jar,这是否可能?

Thanks, cheers谢谢,加油

It is a very bad idea to have more then one applications in one jar.在一个 jar 中包含多个应用程序是一个非常糟糕的主意。 Auto-configuration is very sensitive to dependencies.自动配置对依赖关系非常敏感。 Spring Boot makes own estimations about application based on those dependencies. Spring Boot 基于这些依赖对应用程序做出自己的估计。 I had two classes annotated with @SpringBootApplication in one jar file.我在一个 jar 文件中有两个用 @SpringBootApplication 注释的类。 Spring Boot did not initialize database with my data.xml file. Spring Boot 没有使用我的 data.xml 文件初始化数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM