SlideShare a Scribd company logo
Mahika Tutorials
Spring Framework
Tutorials
Mahika Tutorials
Using MessageSource
to get text from properties file
INTRODUCTIONTO
SPRING
Mahika Tutorials
Mahika Tutorials
 Spring is a light weight and open source framework created by Rod
Johnson in 2003.
Mahika Tutorials
Spring Application
Spring jars
 Spring framework makes the development of Java/JavaEE application
easy.
Mahika Tutorials
Dtababase Connectivity
Transaction Management
Dependency Injection
AOP
 Spring can be thought of as a framework of frameworks because it provides
support to various frameworks such as Struts, Hibernate, EJB, JSF etc.
Mahika Tutorials
Spring
JSF
EJB
Hibernate
Struts
 Spring enables you to build applications from “plain old Java objects”
(POJOs).
Mahika Tutorials
 Spring framework is said to be a non-invasive means it doesn’t force a
programmer to extend or implement their class from any predefined
class or interface given by Spring API.
Mahika Tutorials
 Spring applications are loosely coupled because of dependency
injection and Inversion of Control(IOC).
Mahika Tutorials
Employee
Address address;
Employee(){
address=newAddress(“XYZ Street ,”Pune”);
}
Employee
Address address;
Third Party
Address
instance
Tight Coupling Loose Coupling
Spring Modules
Mahika Tutorials
Core Container
Mahika Tutorials
 Core and Beans:These modules provide IOC and Dependency Injection features.
 Context:This module supports internationalization (I18N), EJB, JMS, Basic Remoting.
 SpEL: It is an extension to the EL defined in JSP. It provides support to setting and getting property values,
method invocation, accessing collections, named variables, logical and arithmetic operators, retrieval of
objects by name etc.
Data Access / Integration-
Mahika Tutorials
 These modules basically provide support to interact with the database.
 The JDBC module removes the need to do tedious JDBC coding.
 ORM module is used to tie up with ORM tools such as hibernate.
Web
Mahika Tutorials
 These modules provide support to create web application.
Test
 This module supports the testing of Spring components with JUnit orTestNG.
Mahika Tutorials
Mahika Tutorials
Dependency Injection &IOC
Dependency Injection
 Dependency Injection (DI) is a software design pattern that deals with how components get hold of their
dependencies.
 A class X has a dependency to classY, if class X uses classY as a variable.
 Java components / classes should be as independent as possible of other Java classes.
 This increases the possibility to reuse these classes and to test them independently of other classes(UnitTesting).
 Dependency injection is a style of object configuration in which an object’s fields are set by an external entity, in other
words objects are configured by an external entity.
 Dependency injection is an alternative to having the object configure itself.
Mahika Tutorials
class X
{
Y y;
……………
}
Dependency Injection and Inversion of Control
Mahika Tutorials
A
C
B
Dependency
A
C
B
Injection
Inversion of Control is a principle by which the control of objects is transferred to a
container or framework.
Dependency injection is a pattern through which IoC is implemented, where the control
being inverted is the setting of object’s dependencies.
The act of connecting objects with other objects, or “injecting” objects into other objects,
is done by container rather than by the objects themselves.
A class should not configure itself but should be configured from outside.
Mahika Tutorials
Dependency Injection and Inversion of Control
Dependency Injection and Inversion of Control
 IOC makes the code loosely coupled. In such case, there is no need to
modify the code if our logic is moved to new environment.
 IOC makes the application easy to test.
 In Spring framework, IOC container is responsible to inject the
dependency. We provide metadata to the IOC container either by XML
file or annotation
Mahika Tutorials
Dependency Injection
Spring framework provides two ways to inject dependency
By Constructor (Constructor Injection)-In the case of constructor-based dependency
injection, the container will invoke a constructor with arguments each representing a
dependency we want to set.
By Setter method (Setter Injection)-For setter-based DI, the container will call setter
methods of our class.
Mahika Tutorials
class Employee{
Address address;
Employee(){
address=newAddress(“XYZ Street”, ”Pune”, ”MH”);
}
…………………..
}
With IOC (setter Injection)Without IOC
class Employee{
Address address;
public void setAddress(Address address){
this.address=address;
}
………
}
With IOC (constructor Injection)
class Employee{
Address address;
Employee(Address address){
this.address=address;
………
}
}
Mahika Tutorials
Mahika Tutorials
BeanFactory & AplicationContext
IOC
 In Spring framework, IOC container is responsible to inject the dependencies.We provide metadata
to the IOC container either by XML file or annotation.
 The IoC container is responsible to instantiate, configure and assemble the objects.
Mahika Tutorials
BeanFactory
ApplicationContext
IOC
containers
BeanFactory
Mahika Tutorials
 Spring BeanFactory Container is the simplest container which provides basic support for DI.
 It is defined by org.springframework.beans.factory.BeanFactory interface.
 There are many implementations of BeanFactory interface . The most commonly used
BeanFactory implementation is –
org.springframework.beans.factory.xml.XmlBeanFactory
 Example-
Resource resource=new ClassPathResource(“Beans.xml");
BeanFactory factory=new XmlBeanFactory(resource);
 The Resource interface has many implementaions. Two mainly used are:
1)org.springframework.core.io.FileSystemResource :Loads the resource from underlying file
system.
Example-
BeanFactory bfObj = new XmlBeanFactory(new FileSystemResource ("c:/beansconfig.xml"));
2)org.springframework.core.io.ClassPathResource:Loads the resource from classpath.
ApplicationContext
The ApplicationContext container is Spring’s advanced container.
It is defined by org.springframework.context.ApplicationContext interface.
The ApplicationContext interface is built on top of the BeanFactory interface.
 It adds some extra functionality than BeanFactory such as simple integration with
Spring's AOP, message resource handling (for I18N), event propagation etc.
There are many implementations of ApplicationContext interface .The most
commonly used ApplicationContext implementation is –
org.springframework.context.support.ClassPathXmlApplicationContext
 Example-
ApplicationContext context=new ClassPathXmlApplicationContext("Beans.xml");
Mahika Tutorials
Mahika Tutorials
Mahika Tutorials
Spring Autowiring
Autowiring in Spring
Mahika Tutorials
 Autowiring means injecting the object dependency implicitly.
 It internally uses setter or constructor injection.
 It works with reference only.
 Autowiring can't be used to inject primitive and string values.
 By default autowiring is disabled in spring framework.
 Autowiring can be performed by either using “autowire” attribute in <bean> or by using @Autowired annotation.
Without Autowiring
Mahika Tutorials
public class Employee {
private int id;
private String name;
private Address address;
…….
}
…….
<bean id="address" class="com.tutorials.demo.Address">
<property name="street" value="Park Street"></property>
<property name="city" value="Pune"></property>
<property name="state" value="Maharashtra"></property>
</bean>
<bean id="emp" class="com.tutorials.demo.Employee">
<property name="id" value="111"></property>
<property name="name" value="Ram"></property>
<property name="address" ref="address"></property>
</bean>
……….
With Autowiring
Mahika Tutorials
public class Employee {
private int id;
private String name;
private Address address;
…….
}
…….
<bean id="address" class="com.tutorials.demo.Address">
<property name="street" value="Park Street"></property>
<property name="city" value="Pune"></property>
<property name="state" value="Maharashtra"></property>
</bean>
<bean id="emp" class="com.tutorials.demo.Employee“ autowire=“byName">
<property name="id" value="111"></property>
<property name="name" value="Ram"></property>
</bean>
……….
Autowiring modes
Mahika Tutorials
No. Mode Description
1) no It is the default autowiring mode. It means no autowiring bydefault.
2) byName The byName mode injects the object dependency according to name of the bean. In such
case, property name and bean name must be same. It internally calls setter method.
3) byType The byType mode injects the object dependency according to type. So property name and
bean name can be different. It internally calls setter method.
4) constructor The constructor mode injects the dependency by calling the constructor of the class. It calls
the constructor having large number of parameters.
5) autodetect It is deprecated since Spring 3.
Mahika Tutorials
Mahika Tutorials
Bean Scopes
Autowiring in Spring
Mahika Tutorials
 Autowiring means injecting the object dependency implicitly.
 It internally uses setter or constructor injection.
 It works with reference only.
 Autowiring can't be used to inject primitive and string values.
 By default autowiring is disabled in spring framework.
 Autowiring can be performed by either using “autowire” attribute in <bean> or by using @Autowired annotation.
Mahika Tutorials

More Related Content

What's hot (19)

PPTX
Introduction to Hibernate Framework
Raveendra R
 
PPT
EJB Clients
Roy Antony Arnold G
 
PPTX
Introduction to JPA Framework
Collaboration Technologies
 
PDF
Hibernate II
People Strategists
 
PPTX
Hibernate ppt
Aneega
 
PDF
Data access
Joshua Yoon
 
PPTX
Functional Dependency Injection in C#
Thomas Jaskula
 
PPTX
JPA For Beginner's
NarayanaMurthy Ganashree
 
PDF
Spring Framework-II
People Strategists
 
PDF
Introduction to JPA and Hibernate including examples
ecosio GmbH
 
PPT
Introduction to Hibernate
Krishnakanth Goud
 
ODT
Types of Dependency Injection in Spring
Sunil kumar Mohanty
 
PDF
Overview of JEE Technology
People Strategists
 
DOC
Hibernate tutorial for beginners
Rahul Jain
 
PPTX
Technical Interview
prashant patel
 
PDF
Hibernate Interview Questions
Syed Shahul
 
PPTX
Massively Scalable Applications - TechFerry
TechFerry
 
PDF
Spring Framework - III
People Strategists
 
PPTX
Introduction to OO, Java and Eclipse/WebSphere
eLink Business Innovations
 
Introduction to Hibernate Framework
Raveendra R
 
EJB Clients
Roy Antony Arnold G
 
Introduction to JPA Framework
Collaboration Technologies
 
Hibernate II
People Strategists
 
Hibernate ppt
Aneega
 
Data access
Joshua Yoon
 
Functional Dependency Injection in C#
Thomas Jaskula
 
JPA For Beginner's
NarayanaMurthy Ganashree
 
Spring Framework-II
People Strategists
 
Introduction to JPA and Hibernate including examples
ecosio GmbH
 
Introduction to Hibernate
Krishnakanth Goud
 
Types of Dependency Injection in Spring
Sunil kumar Mohanty
 
Overview of JEE Technology
People Strategists
 
Hibernate tutorial for beginners
Rahul Jain
 
Technical Interview
prashant patel
 
Hibernate Interview Questions
Syed Shahul
 
Massively Scalable Applications - TechFerry
TechFerry
 
Spring Framework - III
People Strategists
 
Introduction to OO, Java and Eclipse/WebSphere
eLink Business Innovations
 

Similar to Spring FrameWork Tutorials Java Language (20)

PPT
Spring overview &amp; architecture
saurabhshcs
 
PPTX
Spring framework
Sonal Poddar
 
PPTX
Introduction to Spring Framework
Dineesha Suraweera
 
PPTX
Spring framework
Rajkumar Singh
 
PPTX
Spring framework in depth
Vinay Kumar
 
PDF
springtraning-7024840-phpapp01.pdf
BruceLee275640
 
PDF
Introduction to Spring Framework
Rajind Ruparathna
 
ODT
Spring framework
Shivi Kashyap
 
PDF
Spring mvc
Hamid Ghorbani
 
PDF
Spring Framework Tutorial | VirtualNuggets
Virtual Nuggets
 
PPTX
Brownbag001 spring ioc from 2012
Timothy Spann
 
ODP
Dependency Injection in Spring in 10min
Corneil du Plessis
 
PPTX
Spring tutorials
TIB Academy
 
PDF
Spring framework Introduction
Anuj Singh Rajput
 
PPTX
Introduction to Spring sec1.pptx
NourhanTarek23
 
PDF
Spring framework
Aircon Chen
 
PPTX
Spring framework IOC and Dependency Injection
Anuj Singh Rajput
 
PPTX
Skillwise-Spring framework 1
Skillwise Group
 
PPT
Spring introduction
Manav Prasad
 
PDF
Dependency Injection
ColdFusionConference
 
Spring overview &amp; architecture
saurabhshcs
 
Spring framework
Sonal Poddar
 
Introduction to Spring Framework
Dineesha Suraweera
 
Spring framework
Rajkumar Singh
 
Spring framework in depth
Vinay Kumar
 
springtraning-7024840-phpapp01.pdf
BruceLee275640
 
Introduction to Spring Framework
Rajind Ruparathna
 
Spring framework
Shivi Kashyap
 
Spring mvc
Hamid Ghorbani
 
Spring Framework Tutorial | VirtualNuggets
Virtual Nuggets
 
Brownbag001 spring ioc from 2012
Timothy Spann
 
Dependency Injection in Spring in 10min
Corneil du Plessis
 
Spring tutorials
TIB Academy
 
Spring framework Introduction
Anuj Singh Rajput
 
Introduction to Spring sec1.pptx
NourhanTarek23
 
Spring framework
Aircon Chen
 
Spring framework IOC and Dependency Injection
Anuj Singh Rajput
 
Skillwise-Spring framework 1
Skillwise Group
 
Spring introduction
Manav Prasad
 
Dependency Injection
ColdFusionConference
 
Ad

Recently uploaded (20)

PDF
MODULE-5 notes [BCG402-CG&V] PART-B.pdf
Alvas Institute of Engineering and technology, Moodabidri
 
PPTX
How Industrial Project Management Differs From Construction.pptx
jamespit799
 
PPTX
MODULE 04 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PPTX
澳洲电子毕业证澳大利亚圣母大学水印成绩单UNDA学生证网上可查学历
Taqyea
 
PPTX
OCS353 DATA SCIENCE FUNDAMENTALS- Unit 1 Introduction to Data Science
A R SIVANESH M.E., (Ph.D)
 
PDF
3rd International Conference on Machine Learning and IoT (MLIoT 2025)
ClaraZara1
 
PPTX
MODULE 05 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PDF
Data structures notes for unit 2 in computer science.pdf
sshubhamsingh265
 
PDF
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
PPTX
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
PDF
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
PDF
SERVERLESS PERSONAL TO-DO LIST APPLICATION
anushaashraf20
 
PDF
Digital water marking system project report
Kamal Acharya
 
PPTX
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
PDF
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
PDF
Electrical Engineer operation Supervisor
ssaruntatapower143
 
PDF
mbse_An_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
PPTX
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
PPTX
Introduction to Internal Combustion Engines - Types, Working and Camparison.pptx
UtkarshPatil98
 
PDF
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
MODULE-5 notes [BCG402-CG&V] PART-B.pdf
Alvas Institute of Engineering and technology, Moodabidri
 
How Industrial Project Management Differs From Construction.pptx
jamespit799
 
MODULE 04 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
澳洲电子毕业证澳大利亚圣母大学水印成绩单UNDA学生证网上可查学历
Taqyea
 
OCS353 DATA SCIENCE FUNDAMENTALS- Unit 1 Introduction to Data Science
A R SIVANESH M.E., (Ph.D)
 
3rd International Conference on Machine Learning and IoT (MLIoT 2025)
ClaraZara1
 
MODULE 05 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
Data structures notes for unit 2 in computer science.pdf
sshubhamsingh265
 
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
SERVERLESS PERSONAL TO-DO LIST APPLICATION
anushaashraf20
 
Digital water marking system project report
Kamal Acharya
 
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
Electrical Engineer operation Supervisor
ssaruntatapower143
 
mbse_An_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
Introduction to Internal Combustion Engines - Types, Working and Camparison.pptx
UtkarshPatil98
 
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
Ad

Spring FrameWork Tutorials Java Language

  • 2. Mahika Tutorials Using MessageSource to get text from properties file
  • 4.  Spring is a light weight and open source framework created by Rod Johnson in 2003. Mahika Tutorials Spring Application Spring jars
  • 5.  Spring framework makes the development of Java/JavaEE application easy. Mahika Tutorials Dtababase Connectivity Transaction Management Dependency Injection AOP
  • 6.  Spring can be thought of as a framework of frameworks because it provides support to various frameworks such as Struts, Hibernate, EJB, JSF etc. Mahika Tutorials Spring JSF EJB Hibernate Struts
  • 7.  Spring enables you to build applications from “plain old Java objects” (POJOs). Mahika Tutorials
  • 8.  Spring framework is said to be a non-invasive means it doesn’t force a programmer to extend or implement their class from any predefined class or interface given by Spring API. Mahika Tutorials
  • 9.  Spring applications are loosely coupled because of dependency injection and Inversion of Control(IOC). Mahika Tutorials Employee Address address; Employee(){ address=newAddress(“XYZ Street ,”Pune”); } Employee Address address; Third Party Address instance Tight Coupling Loose Coupling
  • 11. Core Container Mahika Tutorials  Core and Beans:These modules provide IOC and Dependency Injection features.  Context:This module supports internationalization (I18N), EJB, JMS, Basic Remoting.  SpEL: It is an extension to the EL defined in JSP. It provides support to setting and getting property values, method invocation, accessing collections, named variables, logical and arithmetic operators, retrieval of objects by name etc.
  • 12. Data Access / Integration- Mahika Tutorials  These modules basically provide support to interact with the database.  The JDBC module removes the need to do tedious JDBC coding.  ORM module is used to tie up with ORM tools such as hibernate.
  • 13. Web Mahika Tutorials  These modules provide support to create web application. Test  This module supports the testing of Spring components with JUnit orTestNG.
  • 16. Dependency Injection  Dependency Injection (DI) is a software design pattern that deals with how components get hold of their dependencies.  A class X has a dependency to classY, if class X uses classY as a variable.  Java components / classes should be as independent as possible of other Java classes.  This increases the possibility to reuse these classes and to test them independently of other classes(UnitTesting).  Dependency injection is a style of object configuration in which an object’s fields are set by an external entity, in other words objects are configured by an external entity.  Dependency injection is an alternative to having the object configure itself. Mahika Tutorials class X { Y y; …………… }
  • 17. Dependency Injection and Inversion of Control Mahika Tutorials A C B Dependency A C B Injection
  • 18. Inversion of Control is a principle by which the control of objects is transferred to a container or framework. Dependency injection is a pattern through which IoC is implemented, where the control being inverted is the setting of object’s dependencies. The act of connecting objects with other objects, or “injecting” objects into other objects, is done by container rather than by the objects themselves. A class should not configure itself but should be configured from outside. Mahika Tutorials Dependency Injection and Inversion of Control
  • 19. Dependency Injection and Inversion of Control  IOC makes the code loosely coupled. In such case, there is no need to modify the code if our logic is moved to new environment.  IOC makes the application easy to test.  In Spring framework, IOC container is responsible to inject the dependency. We provide metadata to the IOC container either by XML file or annotation Mahika Tutorials
  • 20. Dependency Injection Spring framework provides two ways to inject dependency By Constructor (Constructor Injection)-In the case of constructor-based dependency injection, the container will invoke a constructor with arguments each representing a dependency we want to set. By Setter method (Setter Injection)-For setter-based DI, the container will call setter methods of our class. Mahika Tutorials class Employee{ Address address; Employee(){ address=newAddress(“XYZ Street”, ”Pune”, ”MH”); } ………………….. } With IOC (setter Injection)Without IOC class Employee{ Address address; public void setAddress(Address address){ this.address=address; } ……… } With IOC (constructor Injection) class Employee{ Address address; Employee(Address address){ this.address=address; ……… } }
  • 22. Mahika Tutorials BeanFactory & AplicationContext
  • 23. IOC  In Spring framework, IOC container is responsible to inject the dependencies.We provide metadata to the IOC container either by XML file or annotation.  The IoC container is responsible to instantiate, configure and assemble the objects. Mahika Tutorials BeanFactory ApplicationContext IOC containers
  • 24. BeanFactory Mahika Tutorials  Spring BeanFactory Container is the simplest container which provides basic support for DI.  It is defined by org.springframework.beans.factory.BeanFactory interface.  There are many implementations of BeanFactory interface . The most commonly used BeanFactory implementation is – org.springframework.beans.factory.xml.XmlBeanFactory  Example- Resource resource=new ClassPathResource(“Beans.xml"); BeanFactory factory=new XmlBeanFactory(resource);  The Resource interface has many implementaions. Two mainly used are: 1)org.springframework.core.io.FileSystemResource :Loads the resource from underlying file system. Example- BeanFactory bfObj = new XmlBeanFactory(new FileSystemResource ("c:/beansconfig.xml")); 2)org.springframework.core.io.ClassPathResource:Loads the resource from classpath.
  • 25. ApplicationContext The ApplicationContext container is Spring’s advanced container. It is defined by org.springframework.context.ApplicationContext interface. The ApplicationContext interface is built on top of the BeanFactory interface.  It adds some extra functionality than BeanFactory such as simple integration with Spring's AOP, message resource handling (for I18N), event propagation etc. There are many implementations of ApplicationContext interface .The most commonly used ApplicationContext implementation is – org.springframework.context.support.ClassPathXmlApplicationContext  Example- ApplicationContext context=new ClassPathXmlApplicationContext("Beans.xml"); Mahika Tutorials
  • 28. Autowiring in Spring Mahika Tutorials  Autowiring means injecting the object dependency implicitly.  It internally uses setter or constructor injection.  It works with reference only.  Autowiring can't be used to inject primitive and string values.  By default autowiring is disabled in spring framework.  Autowiring can be performed by either using “autowire” attribute in <bean> or by using @Autowired annotation.
  • 29. Without Autowiring Mahika Tutorials public class Employee { private int id; private String name; private Address address; ……. } ……. <bean id="address" class="com.tutorials.demo.Address"> <property name="street" value="Park Street"></property> <property name="city" value="Pune"></property> <property name="state" value="Maharashtra"></property> </bean> <bean id="emp" class="com.tutorials.demo.Employee"> <property name="id" value="111"></property> <property name="name" value="Ram"></property> <property name="address" ref="address"></property> </bean> ……….
  • 30. With Autowiring Mahika Tutorials public class Employee { private int id; private String name; private Address address; ……. } ……. <bean id="address" class="com.tutorials.demo.Address"> <property name="street" value="Park Street"></property> <property name="city" value="Pune"></property> <property name="state" value="Maharashtra"></property> </bean> <bean id="emp" class="com.tutorials.demo.Employee“ autowire=“byName"> <property name="id" value="111"></property> <property name="name" value="Ram"></property> </bean> ……….
  • 31. Autowiring modes Mahika Tutorials No. Mode Description 1) no It is the default autowiring mode. It means no autowiring bydefault. 2) byName The byName mode injects the object dependency according to name of the bean. In such case, property name and bean name must be same. It internally calls setter method. 3) byType The byType mode injects the object dependency according to type. So property name and bean name can be different. It internally calls setter method. 4) constructor The constructor mode injects the dependency by calling the constructor of the class. It calls the constructor having large number of parameters. 5) autodetect It is deprecated since Spring 3.
  • 34. Autowiring in Spring Mahika Tutorials  Autowiring means injecting the object dependency implicitly.  It internally uses setter or constructor injection.  It works with reference only.  Autowiring can't be used to inject primitive and string values.  By default autowiring is disabled in spring framework.  Autowiring can be performed by either using “autowire” attribute in <bean> or by using @Autowired annotation.