EJB。它是什么、为什么存在以及它如何运作?

发布于 2024-08-22 18:45:08 字数 105 浏览 2 评论 0原文

伙计们,我已经尝试阅读大量有关 EJB 的内容。我不明白。看来大多数作者对此的了解还很肤浅。他们基本上说这是业务逻辑“东西”。他们没有展示它如何与应用程序服务器交互等等,它做什么,如何以及为什么?

Guys, I HAVE tried reading tons of stuff about EJB. And I don't get it. It seems that most of the authors have a superficial knowledge on it. They basically say it's the business-logic 'stuff'. They don't show it how it interacts with the AppServer and so on, what it does, how, and why?

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

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

发布评论

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

评论(3

-黛色若梦 2024-08-29 18:45:08

这是一个很大的问题,但也不是那么大。这不像问什么是物理学。您基本上在容器内运行业务代码,该容器处理所有连接查找事务等。ejb 有替代方案,例如 spring

It is a huge question, but not that huge. It is not like asking what is physics. You basically run your business code inside container which is handling all the connections, lookup, transactions etc. There are alternatives to ejb, e.g. spring.

谎言 2024-08-29 18:45:08

这个问题确实很大。一般意义上的 EJB 尝试强制执行一种设计模式,将所有可重用代码或“业务逻辑”封装到架构中的特定层中。通过这样做,您可以将此代码重用于您的 Web/表示层和 Web 服务。 EJB 提供了一种将数据保存到数据库的方法。

如今 Java 开发的趋势是利用依赖注入的 POJO 驱动架构。 Spring 是促进这种设计模式的流行工具,我鼓励您探索它而不是 EJB。

The question is huge indeed. EJBs in a general sense try to enforce a design pattern that encapsulates all of your reusable code or "business logic" into a specific tier in your architecture. By doing this you can reuse this code for your web/presentation layer and web services for example. EJBs provide a way of persisting your data to a DB.

The trend in java development now a days is POJO driven architectures that leverage dependency injection. Spring is a popular tool to facilitate this design pattern and I would encourage you to explore this instead of EJB.

感受沵的脚步 2024-08-29 18:45:08

企业 Bean 是一个服务器端组件,它
封装了应用程序的业务逻辑。业务逻辑是实现以下功能的代码
申请的目的。例如,在库存控制应用程序中,企业
beans 可能会在名为 checkInventoryLevel 的方法中实现业务逻辑,并且
订单产品。通过调用这些方法,客户端可以访问提供的库存服务
通过应用程序。

an enterprise bean is a server-side component that
encapsulates the business logic of an application. The business logic is the code that fulfills the
purpose of the application. In an inventory control application, for example, the enterprise
beans might implement the business logic in methods called checkInventoryLevel and
orderProduct. By invoking these methods, clients can access the inventory services provided
by the application.

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