![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Spring
Mr_LGZ
专业Java后台和Linux系统
展开
-
Spring笔记-通过Spring的配置文件来配置bean
IOC:反转控制,反转资源获取。如:以前买菜(Bean)需要到菜市场,现在只需要在家门口放菜篮子,就有主动(Spring)动送菜来。DI:依赖注入。Spring的配置文件:applicatioContext.xml<beans> <!--配置一个bean说明--> <!-- id:配置一个bean并赋值一个id,建议类名的第一个字母小写 clas原创 2017-08-24 20:36:48 · 239 阅读 · 0 评论 -
Spring笔记2-基于注解的方式配置Bean
<Beans> <!--需要扫描的包 base-packpage - com.spring.annotation及子包下的带有注解的Bean将会配置到IOC容器 注解有: @Component @Respository @Service @Contorller 可以通过resour原创 2017-08-27 00:22:48 · 228 阅读 · 0 评论 -
Spring笔记3-泛型依赖注入
springContext.xml<beans> <context:componemt-scan base-package="com.test"></context:componemt-scan></beans>package com.test;public class BaseRepository<T> {}package com.test;import org.springfra原创 2017-08-27 00:28:12 · 579 阅读 · 0 评论 -
Spring笔记4-AOP,前置通知,后置通知,返回通知,异常通知
<beans> <!--配置自动扫描的包--> <context:componemt-scan base-package="com.kcj.test"></context:componemt-scan> <!--使用Aspectj注解,自动为匹配的类生成代理对象--> <aop:aspectj-autoproxy></aop:aspectj-autoproxy></b原创 2017-08-27 19:20:09 · 555 阅读 · 0 评论 -
Spring笔记5-基于配置文件的方式配置AOP
<beans> <!--配置普通的bean--> <bean id="testAspectImpl" class="com.kcj.test.TestAspectImpl"></bean> <!--配置切面bean--> <bean id="loggingAspect" class="com.kcj.test.LoggingAspect"></bean> <!--配原创 2017-08-27 19:48:26 · 377 阅读 · 0 评论 -
spring笔记6-事物及整合hibernate
<beans> <!-- 配置自动扫描的包 --> <context:component-scan base-package="com.lgz.spring.hibernate"></context:component-scan> <!-- 1.配置数据源 --> <!-- 导入资源文件 --> <context:property-placeholder lo原创 2017-08-27 22:10:50 · 284 阅读 · 0 评论