Introduction to the Spring IoC container and beans


3 The IoC container(IOC容器)
3.1 Introduction to the Spring IoC container and beans(Spring IOC容器とbeansの紹介)
This chapter covers the Spring Fraamewaork implementation of the Inversion of Conttrol(IoC)[1]prinnciple.IoC isalsoknowasdependency injection(DI).It is a process whereebyjeoooooooooobustststststinininininininininininininininininininininininininininininininininininininininstststststststthethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethea factory method、or properties that are set on the object instance after it is constructed from a factory method.The container then inject s those dependencies when it creates the bean.This process fundenlythe the inverseof the bean itself controling the instantiation or location of dependencies by using direct construct of clases、or a mechaism such as the Service Locator pattern.
この章ではSpring FraamewarkのIOC容器実現原理を紹介し、IOC容器も注入依存となり、これは対象が自分に依存する過程を定義するもので、つまり他の対象に依存してこそ正常に働くことができる.パラメータ、工場法のパラメータを構成するか、またはsetから対象のパラメータを使用して、工場法から構成されています.これらの依存性はbeanを作成する際に注入しやすく,このプロセスでは反応するので逆制御と名付けられた.クラスの構造方法またはサービスポジショニングモードを直接使用して、bean自身の実用化または位置決めを実現する.
The org.springframe ewaork.beans and org.springfraameeweork.com packagage packararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararararring’s AOP feat ures;message resource handling,event publication;and appication-layer specific contexts such as the WebApplication Comptext for use inウェブアプリplications.org.springframework.beansおよびorg.springframework.contextは、スプリングフレームワークIOCの容易な基礎であり、BenFactoryインターフェースは、すべてのタイプのオブジェクトを管理するための高級な構成機構を提供する.Apple ContectはBeanFactoryのサブインターフェースであり、以下の簡単なAOP機能の集積、メッセージリソース処理(国際化のための)、イベントのリリース、ウェブプログラムで使用されるWebApplication Contextなどのアプリケーション層の特定のコンテキストを追加しています.
In shot,the BeanFactory provides the configration frame ework and baic functionlity,and the Application Conterpris-specifinic functionly.The Applity Cont is a compect superset of the BeanFactoryand is used exclusively in this chapter in descriptions of Spring’s IoC container.For more information on the BeanFactory instory of the Aplication Controxt,refer to Sectory 3.16,The BeanFactory.
簡単に言えば、BenFactoryは構成フレームとその基本機能を提供しています.Application Contectは、より多くの企業固有の機能を提供しています.Apple ContectはBenFactoryの完全な特集であり、本章の中で専らIよ容器を拭くことについて説明しています.BeanFactoryに関する情報を知りたいなら、3.16「The BeanFactory」を参照してください.
In Spring、the ooojectsthat form the backbone of youraplication and that arararararararare managed bythe Spring IoC containararararararararararaabeans.A bean isisaabject thththaatsinstantiated,asaseeemiblbled,aseemibld,aseemiblbled,andbled,andemibld,andandandandandand,andandandandandandandandandandandandand Spothehethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethedependencies among them、are refreted in the configration metadata used by a container.
Springではアプリケーションを構成する主幹をbeansと呼び、IOC容器を管理しています.Beanは、IOCによって実装しやすく、組み立て及び操作管理対象となる.その他に、一つのbeanは多くのobjectの一つを応用しています.ビーズと彼らの間の依存関係は容器で使用する構成要素情報にマッピングして反射する.
3.2 Continer overview
容器の概要
The interface org.spring frame ebook.com.text.Apple Contact represents the Spring IoC container and is reponsible for instantiating,configling,and asem bling the aforementions.The contions.and assiemible by reading configration metadata.The configration metadata is represented in XML,Java annotations,or Java code.It allows you to express the object the comporse your appection and and the the the rich intrabrectwence
org.spring frame ebook.com.Application ContectインターフェースはSpringのIOC容器を表しています.実際の配置と組み立てを担当しています.また、設定データを読み込むことによって、それらのオブジェクトが実装されるべき配置と組み立てられています.メタデータはXMLファイル、JAVA注解またはJAVAコードを使用して実現されます.あなたが応用する各objectを組み立てるということと、objectとの関係を説明します.
Several implemenations of the AppplicationConttexinterface ars supplied out off-the-box with Spring.In standloinaplications itiscomon to creaaaaaaaaaaaaaaaaastancs of ClaasPathXmlAppplication Cotexor or or or FilethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethethetherererererereremmmmmmmfififitttttttttttttttttttttttttttttttttttteJava annotations or code as the metadata format by providing a small amount of XML configration to declarabiely enable support for these additional metadata formas.
SpringもApplication Contectインターフェースのいくつかの具体的な実現を提供しています.独立したアプリケーションでは通常Class PathXml Application Contactを作成します.またはFileSystemXlApplication Controtextを作成します.XMLで設定データを定義する習慣がありますが、AVAの注釈やJAVAコードを通してIOC容器に通知することをサポートします.
In most appection scenaros、explicit user code is not required to instantiate one or more instance of a Spring IoC container.For example、in a web appication scenaro、a simple eigh(or so)line of boilerplapteweetウェブサイト.「Conventient Application Contect instantiation for web appration」).If you are using the Spring Tool Suite Eclipse-powered development environment this boilerplate configration can be ease created with few mouse clease ketres.
多くのアプリケーションシーンでは、表示する必要のない例示的なSpring IOC容器を例に挙げて、WEB開発の過程で、WEB.xmlに8行ぐらいの配置ファイルを追加すれば十分です.EclipseのSpring Toolという強力な開発環境を利用すれば、このような配置サンプルはいくつかのデータまたはキーボードをクリックして完成できます.
The follwing diagram is a high-level view of how Spring works.Your appication clases are commbined with configration metadata so that after the Aplication Contatxt is created and initiazed,you have fullemited fireemited.
ここではSpringがどのように動作しているかを示すための高級なビューを提供します.アプリケーションと構成メタデータを組み合わせて、Appplication Contectの作成初期化後、実行可能なシステムまたはアプリケーションがあります.