Play框架和OSGI
是否可以将 Play 框架与 OSGI 集成以创建可插入组件?有人尝试过吗?
Is it possible to integrate play framework with OSGI to create plugable components? Did someone try it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的意思是“使用 OSGi 创建 Play 模块”,那么不,它不受支持
如果您的意思是“将 Play 部署为 OSGi 模块”,那么不,它不受支持
公平地说,没有理由推动其支持。作为示例,您可以在 OSGi 上阅读 Spring 创始人的这些想法。 OSGi 会给 Play 增加额外的复杂性,而 Play 的主要目标是成为一个快速开发平台,易于使用,删除一些 Java 约定(如会话)。这有点违背了目的。
If you mean "create Play modules with OSGi", then no, it's not supported
If you mean "deploy Play as an OSGi module" then no, it's not supported
And to be fair, there's no reason to push its support. You can read these thoughts from Spring founder on OSGi, as an example. OSGi would add extra complexity to Play, while the main aim of Play is to be a rapid development platform, simple to use, removing some Java conventions (like Sessions). It would kind of defeat the purpose.
如果我们正在讨论 Play 2,那么绝对值得承认的是,现在 Play 的一个重要且不可或缺的部分是 Akka ,它可以被视为 OSGi 的替代品。从哲学上讲,我认为 Akka 与 Play 和 Scala(一种函数式、无状态、NIO 方法)的核心原则有很多共同点,而 OSGi 更符合 Java EE/Spring 阵营。
这并不是说 Akka 和 OSGi 完全互斥: Akka 的文档 建议您可以将 Akka 部署为 OSGi 包,并创建一些突变应用程序,其中 Akka 参与者通过 OSGi 包启动。
但要回答这个问题,不,Play 不执行 OSGi,但它在很大程度上执行 Akka。
If we're discussing Play 2 then it's definitely worth acknowledging that an important and integral part of Play now is Akka, which could be seen as an alternative to OSGi. Philosophically I think Akka has a lot in common with the core principles of Play and Scala (a functional, stateless, NIO approach), while OSGi is more aligned with the Java EE/Spring camp.
That's not to say that Akka and OSGi are wholly mutually-exclusive: Akka's documentation suggests you can deploy Akka as an OSGi bundle and create some mutant app which has Akka actors firing up via an OSGi bundle.
But to answer the question, no, Play doesn't do OSGi, but it very much does do Akka.