使用 Spring 引导嵌入 Grizzly (glassfish) Servlet 容器 Java

Embed Grizzly (glassfish) Servlet Container with Spring Boot Java

Spring 引导默认使用 Tomcat 作为内部嵌入式 Servlet 容器。 它还支持 Jetty 和 UnderTow。

我已经使用 spring boot 构建了一个 Restful 应用程序。但现在我需要将它部署在 Grizzly (Glassfish) Servlet Container 上。

如何将我的应用程序嵌入 运行 on grizzly,因为 spring 不支持相同的应用程序。

https://github.com/spring-projects/spring-boot/issues/5015.

请帮忙,因为我在这个主题上做了很多研究,但我没有得到任何 link 显示如何为我们的 spring 启动应用程序嵌入一个新的 Servlet 容器,spring dosent 有支持。

谢谢

Grizzly website 声明 Grizzly 的 servlet 支持不完整:

This is not a Servlet compliant implementation and as such, not all features exposed by a typical Servlet container are available here.

我还没有看到任何地方可以扩展那些缺失的功能,但是如果不填补 Grizzly 的 servlet 支持中的一些空白,您尝试做的事情很有可能是不可能的。

假设可能,您需要编写 Spring Boot 的 EmbeddedServletContainerFactoryEmbeddedServletContainer 接口的特定于 Grizzly 的实现。这是相当大的工作量,因此,在开始之前,我会问问自己,与使用 Jetty、Tomcat 或已经得到支持的 Undertow 相比,通过使用 Grizzly 作为嵌入式 servlet 容器,你将获得什么盒子的。

如果您决定解决这个问题,阅读 Jetty、Tomcat 和 Undertow 现有实现的源代码是了解需要做什么的最佳方式:

正如@Andy 所指出的,不支持 Spring Boot 和 Grizzly。 最后我搬到 Spring MVC 同样。

这是我用 grizzly 嵌入 Spring MVC 的工作仓库。 希望对大家有帮助。

Link

现在有 Grizzly 的 Spring 引导启动器的第三方实现,它具有 Spring 引导的 EmbeddedServletContainerFactoryEmbeddedServletContainer [=21] 的特定实现=] 对于 Grizzly.

除此之外,它还通过 Tomcat's Jasper JSP engine, simply by specifying an additional dependency. You can find the project at GitHub and it is also listed in the Spring Boot starters 列表提供 JSP 支持。