Difference [reprint] Java Bean and Spring Bean's

The difference between the Java Bean and Spring Bean

https://blog.csdn.net/qq_42245219/article/details/82748460

  


What is JavaBean:

JavaBean is a JAVA language to write reusable components. JavaBean meet certain specifications written in Java classes, is the norm. Its method name, structure and behavior must meet certain requirements:
     1. All property is private

     2. The class must have a common (public) without reference constructor

     3.private property must provide a public getter and setter access to the outside, and naming also must follow certain naming conventions

     4. This class is serializable, the interface to achieve serializable

What is SpringBean:

SpringBean is the object of all Spring-managed objects can be affected by the Spring container management can become SpringBean.

The difference between the two:

Use different: more traditional javabean pass parameters as a value, and the spring bean use almost everywhere, any component may be referred bean

Different wording: Traditional javabean as target values, it requires that each attribute getter and setter methods are available; however, the spring need only provide bean setter for receiving attribute set value of the injected

Lifecycle different: the traditional javabean as a value object that is passed, do not accept any container to manage its life cycle; in the spring has spring bean life cycle management behavior
----------------
Copyright: this article CSDN blogger "Jackson bees' original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/qq_42245219/article/details/82748460

Guess you like

Origin www.cnblogs.com/jinanxiaolaohu/p/12170378.html