- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我是 Spring MVC 的新手,对 Java 中 java bean 的使用有一点了解。
Java bean 和 Spring bean 的基本区别是什么?
最佳答案
JavaBeans:
At a basic level, JavaBeans are simply Java classes which adhere to certain coding conventions. Specifically, classes that
- have
public
default (no argument) constructors- allow access to their properties using accessor (getter and setter) methods
- implement
java.io.Serializable
Spring Beans:
A Spring bean is basically an object managed by Spring. More specifically, it is an object that is instantiated, configured and otherwise managed by a Spring Framework container. Spring beans are defined in Spring configuration files (or, more recently, with annotations), instantiated by Spring containers, and then injected into applications.
请注意,Spring bean 不必总是 JavaBeans。 Spring bean 可能没有实现 java.io.Serializable
接口(interface),可以在其构造函数中包含参数,等等。
这是 JavaBean 和 Spring bean 之间非常基本的区别。
更多信息请引用以上文字出处,Shaun Abram 的文章JavaBeans vs Spring beans vs POJOs .
关于java - JavaBean 和 Spring bean 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21866571/
两个学期前,我有一位教授说: Some of you have been told to always include setter and getter methods for all privat
我遇到了一些问题,我希望有人能知道我可以从哪里开始提出解决方案。我需要在程序执行期间动态创建 JavaBean 或 JavaBean 属性。我从数据库中检索列名,然后从特定表中选择这些值,并且我需要能
我想将大量 bean 的属性从一个 JavaBean 复制到另一个。我查看了 Apache Commons BeanUtils .但问题是它希望两个 bean 中的属性名称相同。无法提供映射。 例如在
我在设置一个属于另一个 bean 的 bean 并使其正确更新时遇到问题。更具体地说,我有: public class MyForm extends javax.swing.JFrame {
嘿那里!这只是一个一般性的询问.. 到目前为止,我有一个 servlet,它发送调度操作,许多 JSP 文件.. 但我的问题是 - 像 flickr 这样的典型 Web 应用程序有多少个 javabe
是否有一个实用程序可以创建一个 bean(它具有简单的 String 属性,其名称与 HashMap keys 匹配)给定 bean 类作为输入以及正确设置的 hashmap? 谢谢,阿米特 最佳答案
测试环境:netbeans7.11 + glassfish 3.11这是jsp,类代码: JSP Page
问题:哪些方法使用访问器和修改器的 JavaBeans 命名约定? 上面的代码是正确答案之一: public getNumWings() {return numberWings;} 我检查了 bean
问题 按照我的理解: “Bean” 是一个带有属性和getters/setter方法的Java类。它是不是和C的结构体是相似的呢,对吗?一个“Bean”类与普通的类相比是不是语法的不同呢?还是有特殊的
我不确定我是否正确地标记了这个问题。但我想做的是将 Javabean 映射为我拥有的输入。除了 Bean 包含一个我想要映射到的复杂类型属性(具体来说,我想映射到它的一个属性)。我用代码来解释一下。我
所以我正在做一个小人项目,但遇到了问题。我希望在页面加载时按字母顺序加载信息,但我不知道该怎么做,有什么建议吗?谢谢。这已从之前的内容更新。
有谁知道一个免费的开源库(实用程序类),它允许您比较一个 Java bean 的两个实例并返回一个属性列表/数组,这两个实例的值不同?请发布一个小样本。 干杯 托马斯 最佳答案 BeanCompara
在我的修订列表的 JavaBean 部分中,它声明我应该知道“属性和特性之间的区别”。我真的找不到两者之间的区别。我知道 JavaBeans 使用属性,而普通 Java 类使用属性(或者至少我被教导如
我对 JavaBeans 模式的憎恨就像一千个太阳的火焰一样燃烧。为什么? 冗长。现在是 2009 年。我不应该为一个属性写 7 LOC。如果他们有事件监听器,请捕获你的帽子。 没有类型安全的引用。没
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
我无法找出如何正确地将 JavaBean DS 传递到子子报表。我有以下 Java 代码: JRDataSource javaBeansKapitelDS = new JRBeanColle
我正在为我的桌面 Java 应用程序寻找重要的验证支持。 在JavaEE6中有一个新的validation model 。有没有办法在桌面应用程序中使用它? 最佳答案 我个人没有在纯Java SE环境
我是否应该在 javabean 中声明一个属性,该属性保存用户在 HTML 表单上键入的日期值(字符串或日期)? 我觉得我应该声明为日期,但是,因为我对所有表单数据进行服务器验证,如果日期不验证,当我
你知道我是否可以填充javabean,但我不想使用反射。 例如,我有这个 xml 模板来填充它 示例 XML 文件 public class Customer { private Strin
我有一个带有 date_observed 字段的 Javabean。现在我正在尝试创建一个表单,用户可以在其中搜索开始日期和结束日期之间的条目。 我是否应该创建另一个 Javabean 来扩展此 be
我是一名优秀的程序员,十分优秀!