@Autowired 与@Resource的区别
详情:https://blog.csdn.net/weixin_40423597/article/details/80643990
总结:
1、@Autowired默认根据type类型注入(属于spring的注入方式)
优点:对应的@Component、@Service@Repositry等不用写名字
缺点:但是时间上来说会慢一点
2、@Resource默认根据name名字注入(属于J2EE的注入方式)
优点:注入时间会很快,因为对应名字的搜索比对应类型的快得多
缺点:对应的@Component等要写名字(例:@Service(“userService”))
3.@Autowired要根据name注入的话要写成
@Autowired
@Qualifier("userService")