ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [Java Spring] Spring Bean
    알아두면 좋은것 2018. 12. 5. 12:14

    @Bean

    스프링이 제어권을 가지고 직접 만들고 관계를 부여하는 오브젝트를 빈이라고 한다.(Bean)

    오브젝트 단위의 애플리케이션 컴포넌트를 말한다.

    스프링 빈은 스프링 컨테이너가 생성과 관계설정, 사용 등을 제어해주는 제어의 역전이 적용된 오브젝트를 가리키는 말이다.

    (자주 사용하는 객체를 Singleton 객체로 생성해놓고 어디서든 불러서 쓸 수 있는 것을 의미)



    자세한 내용은 아래를 참고하자

    JavaBean


    JavaBeans are reusable software components for Java that can be manipulated visually in a builder tool. Practically, they are classes written in the Java programming language conforming to a particular convention. They are used to encapsulate many objects into a single object (the bean), so that they can be passed around as a single bean object instead of as multiple individual objects. A JavaBean is a Java Object that is serializable, has a nullary constructor, and allows access to properties using getter and setter methods.


    In order to function as a JavaBean class, an object class must obey certain conventions about method naming, construction, and behavior. These conventions make it possible to have tools that can use, reuse, replace, and connect JavaBeans.


    The required conventions are:


    The class must have a public default constructor. This allows easy instantiation within editing and activation frameworks.

    The class properties must be accessible using get, set, and other methods (so-called accessor methods and mutator methods), following a standard naming convention. This allows easy automated inspection and updating of bean state within frameworks, many of which include custom editors for various types of properties.

    The class should be serializable. This allows applications and frameworks to reliably save, store, and restore the bean's state in a fashion that is independent of the VM and platform.

    Because these requirements are largely expressed as conventions rather than by implementing interfaces, some developers view JavaBeans as Plain Old Java Objects that follow specific naming conventions.

    댓글