Java Bean 和企业 Java Bean 之间的区别? [英] Difference between Java Bean and Enterprise Java Beans?

查看:23
本文介绍了Java Bean 和企业 Java Bean 之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它们是不同的还是可以互换使用?如果它们不同,那么是什么使它们彼此不同?

Are they different or they are used interchangeably? If they are Different, then what made them different from each other?

推荐答案

JavaBean 只是一个普通的旧 Java 对象,它符合某些约定,包括使用访问器函数 (getFoo/setFoo) 进行成员访问、提供默认值构造函数和其他一些类似的东西.

A JavaBean is just a plain old Java object that conforms to certain conventions including the use of accessor functions (getFoo/setFoo) for member access, provision of a default constructor and a few other things like that.

企业 JavaBean 是 Java EE 应用程序服务器中的一个组件,它有多种风格,其细节因您所谈论的 Java EE 版本而异(或者更具体地说,哪一组特定的 EJB 规范是涉及).

An Enterprise JavaBean is a component in a Java EE application server which comes in several flavours, the details of which vary by which version of Java EE you're talking about (or, more specifically, which specific set of EJB specifications are involved).

JavaBeans 最初主要用于构建器工具,提供一个已知的接口,可以通过工具中的自省来查找.然而,他们很快就变成了一种宗教.

JavaBeans were originally mostly intended to be used in builder tools by providing a known interface which could be looked for through introspection in the tools. They quickly turned into what amounts to a religion, however.

企业 JavaBean 旨在为通用容器内的企业应用程序提供封装的业务逻辑,该容器提供会话管理、安全性、资源池等作为服务的服务,从而允许业务逻辑(相对)不受这些跨消除顾虑.(他们是否完成了这一点是一个有争议的问题,因为他们一开始使用起来有多么困难.然而,最新版本的规范使这变得更容易.不过,遗留应用程序仍然很痛苦,可悲的是可能是您可能遇到的大多数 EJB.)

Enterprise JavaBeans are intended to provide encapsulated business logic for enterprise applications within a general container that provided things like session management, security, resource pooling, etc. as services thus allowing the business logic to be (relatively) untainted by these cross-cutting concerns. (Whether or not they accomplished this is a matter that is up for debate, given how difficult they were to use at first. More recent versions of the specification have made this easier, however. Legacy apps, though, are still a pain and sadly likely the majority of the EJBs you're likely to encounter.)

编辑添加:

这篇关于Java Bean 和企业 Java Bean 之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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