@Autowired, @Resource and @Inject

Let us understand @Autowired,@Resource and @Inject All these annotations are used to inject dependent objects in spring. Lets see what is their differences @Resource -> javax.annotation @Inject -> javax.inject @Autowired -> org.springframework.beans.factory.annotation Let’s start with the below example Create Vehicle.java package com.kb.autowire_resource_inject;   public interface Vehicle {   } package com.kb.autowire_resource_inject; public interface Vehicle { […]

Share this article on

Autowire using Annotations

1)Instead of using autowiring feature in spring config file, we can use autowiring in the bean class itself. In the config file we will just define the bean but we will autowire them in the class directly. It reduces the xml coding. Lets see how can we do it in spring. In order to support […]

Share this article on
< Previous Next >