Spring入门(01)

使用Spring的好处:

                          1.降低组件之间耦合度,实现软件各层之间的解耦

                          2.使用容器的各种服务,如 事务处理,消息服务

                          3.实现单例模式(单例singleton 非单例 scope="prototype")

                          4.提供AOP技术,实现权限拦击,运行期控制

                          5.提供辅助类,加快开发进度 JdbcTemplate,HibernateTemplate

                          6.支持主流应用框架提供集成支持,便于应用开发

      懒加载:lazy-init="true" 当spring容器初始化的时候不实例bean,只有在第一次获取(getbean)的时候才初始化

      初始化方法 init-method="initmethod"

      销毁方法  destroy-method="destorymethod"

 

Spring使用到的jar包:

 dist\spring.jar

 lib\jakarta-commons\commons-logging.jar

Aop编程需要的:

 lib\aspectj\aspectjweaver.jar aspectjrt.jar

 libt\cglib\cglib-nodep.jar

注解需要的:

 lib\j2ee\common-annotations.jar

 

Spring的配置文件

<?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"
  xmlns:context="
http://www.springframework.org/schema/context"
     xmlns:tx="
http://www.springframework.org/schema/tx"
 xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
                        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
                        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> 
</beans>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值