Spring UNIT V
Spring UNIT V
RAGHAVENDRA RAO R V
2
Spring Deployment
4
Introduction(1)
Prior to the advent of Enterprise Java Beans (EJB), Java developers needed to use JavaBeans
to create Web applications
Although JavaBeans helped in the development of user interface (UI) components, they were
not able to provide services, such as transaction management and security, which were
required for developing robust and secure enterprise applications
The advent of EJB was seen as a solution to this problem EJB extends the Java components,
such as Web and enterprise components, and provides services that help in enterprise
application development
Developing an enterprise application with EJB was not easy, as the developer needed to
perform various tasks, such as creating Home and Remote interfaces and implementing
lifecycle callback methods which lead to the complexity of providing code for EJBs Due to this
complication, developers started looking for an easier way to develop enterprise applications.
5
Introduction(2)
Spring is an open source lightweight framework that allows Java EE 7 developers to build simple, reliable, and scalable enterprise applications
This framework mainly focuses on providing various ways to help you manage your business objects. It made the development of Web applications
much easier as compared to classic Java frameworks and Application Programming Interfaces (APIs), such as Java database connectivity(JDBC),
JavaServer Pages(JSP), and Java Servlet
The Spring framework can be considered as a collection of sub-frameworks, also called layers,
Spring AOP.
Spring Object-Relational Mapping (Spring ORM).
Spring Web Flow,
Spring Web MVC.
6
IOC Container
Transaction Management
Spring TestContext
Framework
7
Introduction to Features : IoC container
Refers to the core container that uses the DI or IoC pattern to implicitly provide an object
reference in a class during runtime
This pattern acts as an alternative to the service locator pattern
The IoC container contains assembler code that handles the configuration management of
application objects
The Spring framework provides two packages, namely org.springframework.beans and
org.springframework.context which helps in providing the functionality of the IoC container
8
Introduction to Features : Data access Framework
Allows the developers to use persistence APIs, such as JDBC and Hibernate, for storing
persistence data in database
It helps in solving various problems of the developer
How to interact with a database connection
How to make sure that the connection is closed
How to deal with exceptions
How to implement transaction management
It also enables the developers to easily write code to access the persistence data
throughout the application
9
Introduction to Features : Spring MVC framework
Generates Web service endpoints and definitions based on Java classes, but it is difficult
to manage them in an application
To solve this problem, Spring Web Service provides layered-based approaches that are
separately managed by Extensible Markup Language (XML) parsing (the technique of
reading and manipulating XML)
Spring provides effective mapping for transmitting incoming XML message request to an
object and the developer to easily distribute XML message (object) between two
machines
12
Introduction to Features : JDBC abstraction layer
Provides facilities of unit and integration testing for the Spring applications
Spring TestContext framework provides specific integration testing functionalities
Context management
Caching DI of test fixtures
Transactional test management with default rollback semantics
14
Spring Framework Architecture