在一个弹簧启动容器中运行多个Web应用程序

我希望能够有多个Web应用程序共享域项目并在不同的contextPaths下运行。

通过在spring引导应用程序中设置server.contextPath = / webshop,我不需要为所有RequestMappings添加前缀。

我希望网店,管理员和主页共享一个包含所有实体和公共服务的公共域项目。

也许有类似的东西?

public static void main(String[] args) { new SpringApplicationBuilder(Domain.class) .showBanner(false) .child(Admin.class, Webshop.class) .run(args); } 

我的问题是如何使用通用域模型启动Spring启动应用程序,然后使用独特的contextPaths启动一些独立的Web应用程序?

像这样举例如:

 public static void main(String[] args) { start(Admin.class, Webshop.class).run(args); start(Another.class).properties("server.port=${other.port:9000}").run(args); } private static SpringApplicationBuilder start(Class... sources) { return new SpringApplicationBuilder(Domain.class) .showBanner(false) .child(sources); } 

它将在不同的端口上启动两个应用程序。