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>
时间: 2024-12-28 20:16:40