spring入门概念

spring是一个轻量级的IOC和AOP的容器框架,它主要是为了解决企业应用开发的复杂性而诞生的。目的是解决企业应用开发的复杂性。


spring的优点:

低入侵式设计,代码污染极低

write once run anywhere

di有效的降低了耦合度

aop提供了通用任务的集中管理

orm和dao简化了对数据库的访问

高度的开放性,并不强制


IOC:由spring控制对象的生命周期和依赖关系。

DI:依赖注入,ioc期间对象被动态的将依赖关系注入到对象中。

IOC和DI是不同方式描述同一件事情。


AOP

AOP代理其实是由AOP框架动态生成的一个对象,该对象可作为目标对象使用。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
spring.xml标签
beans元素:根节点,beans中定义的全局属性,在bean元素中可以覆盖beans的属性。
属性:default-lazy-init是否延时加载,默认false
    default-dependency-check是否进行依赖关系检查
    default-autowire是否自动注入,默认no   none/byName/byType/constructor/autodetect
元素:description描述
    import引入其他的配置文件
    bean元素
 
bean元素:
属性:
    id
    name
    class
    parent 和class相同,不仅能使用class类中的属性,还能重写
    abstract
    scope
    lazy-init
    autowire
    dependency-check
    depends-on
    init-method
    destroy-method
    factory-method
    factory-bean
 
元素:
    description
    constructor-arg
    property
    lookup-method
    replace-method
 
constructor-arg元素:
    属性:index
        type
    元素:
        description
        bean
        ref
        idref
        list
        set
        map
        props-prop-key
        value
        null      
 
property元素:
    属性:
        name
    元素:
        description
        bean
        ref
        idref
        list
        set
        map
        props-prop-key
        value
        null



本文转自 斯然在天边 51CTO博客,原文链接:http://blog.51cto.com/13172906/1955193,如需转载请自行联系原作者
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值