直接支持JSR-330注入的嵌入式Web容器?

发布于 2024-10-05 15:50:10 字数 516 浏览 0 评论 0原文

我们决定所有的模块化代码都应该使用 JSR-330 依赖注入,并且我们已经使用 Guice 2.1SVN 或 Java EE 6 CDI 在几个项目中进行实际注入,并且效果很好。

我们还剩下一个场景,我需要找到解决方案,即我们有一个在 Java 5 上运行的嵌入式 Web 容器,我希望能够使用 JSR-330 注入来部署 WAR 文件,就像在 Java EE 6 中一样。

我有发现 GlassFish 和 Resin 4 可以做到这一点,但 Java EE 6 Web 配置文件对于此目的来说太大了,因为我们在各自的嵌入式服务器中运行相当小的应用程序。

因此问题是,是否存在一个可以轻松获得本机 JSR-330 支持的 Web 容器,以便我们可以将现有代码部署到其中(为 Java 5 编译),而无需完整的 Weld 或 Guice- Servlet 包含在 WAR 中。将完整的配置套件放置在调用 Web 容器的主代码中是完全可以的,但我不希望在实际的 Web 应用程序部署中使用任何 guice/Spring/weld jar。

We have decided that all our modular code should use JSR-330 dependency injection and we have used Guice 2.1SVN or Java EE 6 CDI to do the actual injection in several projects and has worked very well.

We have one remaining scenario where I need to find a solution, namely that we have an embedded web container running on Java 5 where I would like to be able to deploy WAR-files using JSR-330 injection like in Java EE 6.

I have found that GlassFish and Resin 4 can do this, but the Java EE 6 web profile is simply too large for this purpose as we run quite small applications each in their own embedded server.

Hence the question is, does there exist a web container with native JSR-330 support easily available so we can deploy our existing code into it (compiled for Java 5) without having the full Weld or the Guice-servlet enclosed in the WAR. It is perfectly fine to have a full configuration suite placed in the main code invoking the web container, but I don't want any guice/Spring/weld jars in the actual web application deployment.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泛泛之交 2024-10-12 15:50:10

您是否考虑过使用嵌入式 Jetty 6 或 7?它是开源的并受 Eclipse 支持,因此将获得长期的支持。我一直将它与 Spring for DI 一起使用,发现它非常轻量。非常适合快速迭代开发。

您的问题指定实际应用程序中没有 Guice、Spring 或 Weld jar。 Jetty 允许配置不同的类路径,因此您可以包含 JSR-330 的必要支持实现根据需要。

Have you considered using Jetty 6 or 7 Embedded? It's open source and supported by Eclipse, so will have a long lifetime of support. I use it all the time with Spring for DI and find it extremely lightweight. Ideal for rapid, iterative development.

Your question specifies no Guice, Spring or Weld jars in the actual application. Jetty allows configuration of different classpaths, so you can include the necessary support implementations of JSR-330 as required.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文