What is difference between these 2 injections ?
@Autowired
private DocumentDAO documentDao;
@Resource(name = "documentDao")
private DocumentDAO documentDao;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Simply, @Autowired(specification in Spring) wires by type and @Resource(specification in JSR-250) wires by name .
But, @Autowired with @Qualifier also can autowire by name as @Resource.
Please take a look below links:
@Autowire
@Resource
@Spring Injection with @Resource, @Autowired and @Inject