码迷,mamicode.com
首页 > 编程语言 > 详细

Spring之自动装配bean

时间:2017-08-24 21:19:27      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:自动装配   span   one   spring容器   schema   模式   扫描   org   work   

Spring之自动装配bean

最近学习Spring框架,参考资料是Spring IN ACTION----第一张内容飘过去~~

从第二章的自动装配bean开始,不过学习Spring核心最重要的还是ioc的注入模式吧!

书上是这么说的----(概念问题,哈哈),首先普及几个概念

---------------------------------------------------------------------------------------------------------------------------

<装配>装配创建应用对象之间的协作关系通常称为装配(wiring),这也是依赖注入(DI)的本质;

<POJO>(pure old java object)即具有一部分的getter/setter的类;

<扫描组件>@component----把普通POJO实例化到Spring容器中,相当于把bean自动装配到xml中;

------------------------------------------------------------------------------------------------------------我就不对齐了怎么地!

 

 1 <beans xmlns="http://www.springframework.org/schema/beans"
 2     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 3     xmlns:context="http://www.springframework.org/schema/context"
 4     xmlns:cache="http://www.springframework.org/schema/cache"
 5     xmlns:p="http://www.springframework.org/schema/p"
 6     xsi:schemaLocation="http://www.springframework.org/schema/beans  
 7             http://www.springframework.org/schema/beans/spring-beans-4.1.xsd  
 8             http://www.springframework.org/schema/context  
 9             http://www.springframework.org/schema/context/spring-context-4.1.xsd  
10             http://www.springframework.org/schema/cache
11             http://www.springframework.org/schema/cache/spring-cache-4.1.xsd">
12 </beans>

 

Spring之自动装配bean

标签:自动装配   span   one   spring容器   schema   模式   扫描   org   work   

原文地址:http://www.cnblogs.com/saber-himesama/p/7425043.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!