征服SpringJava学习笔记我爱编程

一、Spring——IoC

2016-08-16  本文已影响201人  穿拖板鞋的加菲猫

IOC概述

一、IOC 控制反转:

二、Spring三大最核心接口:

BeanFactory

ApplicationContext

new ClassPathXmlApplication("classpath:bean.xml") 
 new FileSystemXmlApplicationContext("file:beans.xml")
new AnnotationConfigApplicationContext(Beans.class)

WebApplicationContext

三、Bean生命周期改变方式:

Spring 配置概述:

一、Spring容器高层视图

Bean的实现类
Bean的属性信息,数据库连接数、用户名、秘密
Bean的依赖
Bean的行为配置

二、基于XML的配置

<?xml version="1.0" encoding="UTF-8"?>
<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns.xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns.aop="http://www/springframework.org/schema/aop"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/beans/spring-aop-3.0.xsd 
    ">
    <!--默认命名空间的配置-->
    <bean id="a" class=""/>

    <!--aop命名空间的配置-->
    <aop:config>
    </aop:config>
</beans>

三、基于注解的配置

四、基于Java类的配置

上一篇 下一篇

猜你喜欢

热点阅读