使用 spring boot 配置多个 servletcontainers/servlets [英] Configure multiple servletcontainers/servlets with spring boot

查看:31
本文介绍了使用 spring boot 配置多个 servletcontainers/servlets的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 Spring Boot 在不同端口上加载两个带有嵌入式 tomcat 配置的 servlet 容器.

I want to load two servlet containers with embedded tomcat configuration on different ports with Spring Boot.

有人知道如何实现吗?

推荐答案

它应该很简单:只需创建任意数量的 ApplicationContexts 类型 EmbeddedWebApplicationContext 并提供它们每个 EmbeddedServletContainerFactory 具有不同的端口.示例 此处,其中两个上下文是父级和子级,但这不是设置的必要部分.

It should be simple: just create as many ApplicationContexts of type EmbeddedWebApplicationContext as you need and give them each an EmbeddedServletContainerFactory with a different port. Example here where the two contexts are parent and child, but that's not a necessary part of the setup.

这篇关于使用 spring boot 配置多个 servletcontainers/servlets的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆