控制反转:控制了对象的创建,反转:反转的是获取对象的方式,从自己创建对象变为由Spring工厂推送
1. 搭建Spring环境,导入依赖
- spring-aop:开发AOP特性时需要的JAR
- spring-beans:处理Bean的jar
- spring-context:处理spring上下文的jar
- spring-core.jar:spring核心jar
- spring-expression:spring表达式
还要导入:
- mysql-connection-java
- druid
- mybatis
- mybatis-spring
- log4j

2. application-Context.xml配置文件
先导入模板
<?xml version="1.0" encoding="utf8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/p
http://www.springframework.org/schema/p/spring-p.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx

最低0.47元/天 解锁文章
1048

被折叠的 条评论
为什么被折叠?



