본문 바로가기
개발/스프링

@Autowired vs @Resource (메소드에 한해서..)

by 로그인시러 2016. 10. 27.


Use @Autowired or @Inject. This limitation is covered in the Spring reference documentation: Fine-tuning annotation-based autowiring with qualifiers:

@Autowired applies to fields, constructors, and multi-argument methods, allowing for narrowing through qualifier annotations at the parameter level. By contrast, @Resource is supported only for fields and bean property setter methods with a single argument. As a consequence, stick with qualifiers if your injection target is a constructor or a multi-argument method.


출처 : http://stackoverflow.com/questions/5831128/is-it-possible-to-use-resource-on-a-constructor

댓글