
spring
tomfish88
这个作者很懒,什么都没留下…
展开
-
servlet 引用spring
WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());//获取spring的context ClientConfigClass clientConfigClass = (ClientConfigClass) wac.getBean...原创 2011-03-23 11:43:24 · 139 阅读 · 0 评论 -
spring 装配demo
spring 装配demo原创 2011-03-30 09:15:55 · 112 阅读 · 0 评论 -
spring @component的作用
1、@controller 控制器(注入服务) 2、@service 服务(注入dao) 3、@repository dao(实现dao访问) 4、@component (把普通pojo实例化到spring容器中,相当于配置文件中的<bean id="" class=""/>) @Component,@Service,@Controller,@Re...2012-04-25 10:46:34 · 1544 阅读 · 0 评论 -
教你一招,不是每个bean都需要在xml文件里面配置
applicationContext.getBean("beanName") ; beanName,并不需要在spring 的xml里面配置 只需要在beaName 的类文件上 加上 @Component(" beanName ") 这个注解 然后spring就可以管理这个Bean ,是不是很方便 ...2012-04-27 08:44:53 · 217 阅读 · 0 评论 -
理解spring声明式事务管理
Spring也提供了声明式事务管理。这是通过Spring AOP实现的。 Spring 中进行事务管理的通常方式是利用AOP(面向切片编程)的方式,为普通java类封装事务控制,它是通过动态代理实现的,由于接口是延迟实例化的, spring在这段时间内通过拦截器,加载事务切片。原理就是这样,具体细节请参考jdk中有关动态代理的文档。本文主要讲解如何在spring中进行事务控制。 动态代理的一个重要...2012-04-17 17:50:15 · 139 阅读 · 0 评论