<context:spring-configured/> 的作用
来源:互联网 发布:淘宝订单怎么取消订单 编辑:程序博客网 时间:2024/05/17 15:02
<context:spring-configured/> 的作用
spring 可以为IOC容器里的bean进行依赖注入,但如果某些类,没有配置在IOC里,比如一些Domain Object,是否也可以依赖注入哪?答案是肯定的。
以User 为例,该User并没有配置在IOC理,但我想对其里面的一个UserDao进行依赖注入,其代码如下:
- @Configurable(autowire = Autowire.BY_NAME, dependencyCheck = false)
- public class User {
- private String UserName;
- ....
- private UserDao userDao;
- ...
- @Autowired
- public void setUserDao〔UserDao userDao〕{
- this.userDao=userDao.
- }
- }
然后再在XML文件里加上 <context:spring-configured/>就可以了。
<context:spring-configured/>主要是通过Spring管理AnnotationBeanConfigurerAspect切面, 具体的工作由该切面完成。
阅读全文
0 1
- <context:spring-configured/> 的作用
- <context:spring-configured/> 的作用
- <context:spring-configured/> 的作用
- Spring中<context:annotation-config/>的作用
- 配置Spring <context:annotation-config/>的作用
- Spring中<context:annotation-config/>的作用
- Spring中<context:annotation-config/>的作用
- Spring中<context:annotation-config/>的作用
- Spring中<context:annotation-config/>的作用
- Spring中<context:annotation-config/>的作用
- Spring 配置中<context:annotation-config/> 的作用
- spring中的<context:component-scan base-package="" />的作用
- 在Spring 中<context:annotation-config/>元素的作用
- spring中的标签context component-scan的作用
- Spring初始化:org.springframework.web.context.ContextLoaderListener的作用
- Context的作用
- <context-param>的作用
- context的作用
- 一次性关闭所有的activity
- linux中某个端口拒绝远程主机连接原因及解决方法
- TCP的四种定时器
- 分布式数据库架构--分库、分表、排序、分页、分组、实现
- windows下maven的环境变量配置
- <context:spring-configured/> 的作用
- 创建screen
- h3viewer 集成 到 vs2010中去
- Drawable Resource 之旅(二):ShapeDrawable 详解与应用(仿微信雷达扫描)
- SVN服务器的搭建与使用
- css中盒子模型的理解
- Studio在SVN上为什么要创建分支、如何创建分支跟合并分支、以及报错处理
- 3分钟掌握常用的JS操作JSON方法总结
- SpringMVC的搭建