spring 注解@Resource @Autowired区别
2024-09-24 09:58:14
1、@Autowired寻找类的时候默认是ByType,也就是通过类的类型来寻找类。不过,也可以通过借助@Qualifier("name")来指定寻找的类名
@Autowired
public void setUserDAO(@Qualifier("u2")
2、@Resource默认是按名字来寻找类,当然要指定类的名字,如果不写name,还是按类型来查找类的
@Resource(name="")
最新文章
- JSON字符串和对象 的转换
- 月经贴——.net前景何妨!
- ASP.NET 5系列教程 (三):view components介绍
- 重新想象 Windows 8 Store Apps (66) - 后台任务: 下载和上传
- HDU 2717 Catch That Cow(BFS)
- AsyncQueryHandler 和 CursorAdapter的使用
- 关于Windows Azure的常见问题-执行与维护FAQ
- bzoj 1195: [HNOI2006]最短母串 爆搜
- [iOS]C语言技术视频-15-指针变量高级用法练习一(函数指针完成动态排序)
- JSP手动注入 全
- SpringMVC源码情操陶冶-AbstractHandlerExceptionResolver
- 解决hadoop中 bin/hadoop fs -ls ls: `.': No such file or directory问题
- Android项目-高考作文项目架构(三)
- 写一个python的服务监控程序
- windows下网络编程UDP
- 消息队列RabbitMq、ActiveMq、ZeroMq、kafka之间的比较
- CentOS7配置阿里云源
- Use a load-balancer as a first row of defense against DDOS
- webpack学习笔记—优化缓存、合并、懒加载等
- Aerospike系列:2:商业版和社区版的比较
热门文章
- 解决 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile)
- [Compose] 17. List comprehensions with Applicative Functors
- Vim的使用 区域选择
- SQL语法 之 表连接
- CentOS连接网络注意事项
- mysql优化 慢查询(一)
- Linux-软件包管理-源码包安装
- Linux命令-文件处理命令:less
- 非super user管理会话
- [android开发之内容更新类APP]三、项目的基本功能之布局