0% found this document useful (0 votes)
4 views

Java Spring Tutorial_ Features, History, MVC Framework Architecture

The Java Spring Framework is an open-source framework for building web applications in Java, known for its lightweight and powerful features. It includes a variety of modules for different application requirements, supports MVC architecture, and offers advantages such as ease of testing and modular organization, while also having some drawbacks like restrictions on code visibility. The tutorial covers the framework's history, architecture, installation process, and key concepts like Aspect-Oriented Programming.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Java Spring Tutorial_ Features, History, MVC Framework Architecture

The Java Spring Framework is an open-source framework for building web applications in Java, known for its lightweight and powerful features. It includes a variety of modules for different application requirements, supports MVC architecture, and offers advantages such as ease of testing and modular organization, while also having some drawbacks like restrictions on code visibility. The tutorial covers the framework's history, architecture, installation process, and key concepts like Aspect-Oriented Programming.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

(/)

Java Spring Tutorial: Features, History, MVC


Framework Architecture
What is the Spring framework?
SPRING FRAMEWORK is an open-source framework
for building web applications with Java as a
programming language. It is powerful and
lightweight yet easy to use, and it provides support
for developing Java applications easily. Spring is a
lightweight framework which can be thought of as
a framework of frameworks because it also offers
support for various frameworks such as hibernate,
struts, tapestry, and JSF.

(/images/1/081319_1354_JavaSpringT1.png)
/
In this tutorial, you will learn:

What is the Spring framework?


Features of Spring Framework
Brief History of Spring
Spring Framework Architecture
Spring - MVC Framework
Aspect-Oriented Programming
Installation of Java Spring
Advantages of Spring Framework
Disadvantages of Spring Framework

Features of Spring Framework


Here are some most prominent features of Spring Framework:

Ad

AI for Fashion eCommerce


Visit Sit
omnious.com

Predefined templates
Easy to test
Loose coupling
Lightweight
Fast development
Powerful abstraction
Offers an array of resources
Declarative support
Offers comprehensive tools

Brief History of Spring


Here, are important landmarks form the history of Spring:

Spring framework was written by Rod Johnson and was first released in June 2002.
Spring last version release in March 2004
Spring 1.2.6 version release in 2006
Spring 2.0 version release in Oct 2006
Spring 2.5 version release in Nov 2007
Spring 3 version release in Dec 2009
/
Spring 3.1 version release in Dec 2011
Spring framework 4 version release in Dec 2013 with Java 8 support
Spring framework 4.2.0 version released on July 2015
Spring framework 4.2.1 version released in Sept 2015
Spring Framework 4.3 version released on 10 June 2016
Spring framework 5.0 version released on June 2017

Spring Framework Architecture


The Spring Framework provides 20 modules which can be used based on an application
requirement.

(/images/1/081319_1354_JavaSpringT2.png)

The Core and Bean provide the fundamental part of the framework, including IoC and DI.

Core Container
The Core Container is further divided by subcomponents like Core, Beans, Context, and
Expression Language modules.

Let see each of these models in detail:

Spring Core: /
The Core module provides all the primary component of the spring framework. It includes
IoC (Inversion of Control) and Dependency Injection features.

Spring Bean:
This module offers BeanFactory, which is a sophisticated implementation of the factory
pattern.

Spring Context:
The Context module builds on the solid base provided by the Core and Beans modules, and
it is a medium which helps you to access any objects defined and configured.

Spring Expression Languages (SpEL):

This module offers expression language for modifying and querying object graph during the
runtime.

Data Access/Integration:
The Data Access and Integration layer consist of the JDBC, ORM, JDBC, OXM, JMS, and
Transaction modules.

ORM: ORM module offers consistency/ portability to code irrespective of data access
technologies. It will be based on object-oriented mapping concept.
The JDBC module consists of a JDBC-abstraction layer. It helps you elements the need to
perform JDBC related coding.
OXM: Object XML Mappers (OCM) helps you to convert the objects into XML format and
vice versa.
The Java Messaging Service module offers features like producing and consuming
messages.
Transaction: This module offers declarative and programmatic management method for
implementing unique interfaces and for all types of POJOs (Plain Old Java Object)

Spring Web:
Web: This module uses servlet listeners and a web-oriented application context. It also
offers a feature of web-oriented integration and functionality for multi-part file upload.

Web-servlet: This module stores MVC based implementation for web applications.

Web-Socket: Module offers WebSocket based and two-way communication between the
client and the server in web apps.

/
Web-Portlet: This module is also called Spring-MVC-Portlet module. It offers for Spring-
based Portlets and copies all the functionality of a Web-Servlet module.

AOP: AOP language is a useful tool which allows developers to add enterprise functionality
to the application.

Instrumentation: This module offers class instrumentation and loader implementations. It is


used for specific application servers.

Test: This module provides support for testing of Spring components with TestNG or JUnit
tools. It offers consistent loading of Spring ApplicationContexts and caching of those
contexts.

Spring - MVC Framework

(/images/1/122118_0445_MVCTutorial1.png)

The Spring web MVC framework offers model-view-controller architecture offers


components which helps you to be flexible and loosely coupled web applications.

The MVC pattern allows you to separate different aspects of the application while offering
loose coupling between these elements. Spring MVC also helps you to build flexible and
loosely coupled web applications.
/
The MVC design also allows you to separate business logic, presentation logic, and
navigation logic. It also offers an elegant solution to use MVC in Spring Framework with the
help of DispatcherServlet.

How MVC works in Spring?

(/images/1/081319_1354_JavaSpringT3.png)

DispatcherServlet receives a request.


After that, the DispatcherServlet communicates with HandlerMapping. It also revokes
controller associated with that specific request.
The Controller processes this request by calling the service methods, and a
ModelAndView object returned by the DispatcherServlet.
The view name is sent to a ViewResolver to search the actual View to invoke.
After that, DispatcherServlet is passed to View to render the result.
By using the model data, the View renders and send back result back to the user.

Aspect-Oriented Programming
Aspect-oriented programming allows the global properties of a program to decide how it is
compiled into an executable program.

The key unit of modularity is an aspect instead of a class. Aspect-Oriented programming


breaks down the logic of the program into various parts known as concerns.

A cross-cutting concern may affect the entire application and is centralized in one location
in code like transaction security, management, logging, authentication, etc.

/
(/images/1/081319_1354_JavaSpringT4.png)

It can also be considered as a dynamic decorator design pattern. This pattern also offers an
additional behavior to be added to an existing class by wrapping the original class and
duplicating its interface and removing the original.

Core AOP Concepts

There are seven core concepts in Aspect-Oriented Programming.

Industry-leading patented deep learning OPEN


computer vision technology.

/
(/images/1/081319_1354_JavaSpringT5.png)

Let's discuss them in detail:

Aspect: An aspect is a class which allows implementing the JEE application. It concerns
which cut across multiple classes, like transaction management, security, etc.
Aspects can be a typical class configured using Spring XML configuration or a regular
class annotated using @Aspect annotation.

Joinpoint: It is a candidate point in the program execution where an aspect can be


plugged in. It could be a method being called as an exception being thrown, or even a
field which is modified.
Advice: Advice are the actual actions taken for a specific joinpoint. This method will
execute when a specific joinpoint meets a matching point in the application.
Pointcut: It is an expression which can be matched with join points to check whether that
advice should be executed or not.
Target Object: Based on target object devices are applied. In AOP, a subclass is created at
runtime where the target method should be overridden, and advice are included
depending on their configuration.
Proxy: This object should be created after applying the advice to the target object.
Weaving: This is a method of linking an aspect with other application objects or types to
build an advised object.

Installation of Java Spring


/
Here, is a step by step information to install Java Spring in your computer:

Step 1) Go to www.eclipse.org (https://www.eclipse.org/).

Step 2) Download Eclipse Neon installer and install it on your Windows system.

(/images/1/081319_1354_JavaSpringT6.png)

Step 3) Click on "Download 64-bit" button.

(/images/1/081319_1354_JavaSpringT7.png)

Step 4) Go to Eclipse IDE for Java Developers and click on "64-bit" link.

/
(/images/1/081319_1354_JavaSpringT8.png)

Step 5) Click on "Windows 64-bit" link.

(/images/1/081319_1354_JavaSpringT9.png)

Step 6) Click on the "Download" button to download the zip file.

/
(/images/1/081319_1354_JavaSpringT10.png)

Step 7) Extract the download zip to a specific folder.

(/images/1/081319_1354_JavaSpringT11.png)

Step 8) Click on the "Browse" button to select the workspace directory. /


(/images/1/081319_1354_JavaSpringT12.png)

Automation Design and Build


10+ years worth of in-house automation design and
build.

Sunlight-Tech, Inc. Open

Step 9) Click on "Select Folder" to select a folder.

(/images/1/081319_1354_JavaSpringT13.png)

The process will be displayed as shown in the following screen.

/
(/images/1/081319_1354_JavaSpringT14.png)

Step 10) Opening Eclipse Marketplace Client.

1. Go to the Help menu.


2. Click on "Eclipse Marketpalce" option.

(/images/1/081319_1354_JavaSpringT15.png)

Step 11) Searching and installing Spring plugin.

1. Write Spring in "Find" textbox. /


2. Click on the "Search" icon.
3. Click on the "Install" button to install a plugin.

(/images/1/081319_1354_JavaSpringT16.png)

Step 12) Confirm selected features and click on "Confirm" button.

/
(/images/1/081319_1354_JavaSpringT17.png)

Step 13) Accepting terms and condition and installing the software.

1. Click on "I accept the terms of the license agreements" radio button.
2. Click on "Finish" button" to finish the installation.

/
(/images/1/081319_1354_JavaSpringT18.png)

A welcome screen will be displayed with software installation progress.

/
(/images/1/081319_1354_JavaSpringT19.png)

Step 14) Click on "Restart Now" button to restart Eclipse IDE and apply the changes.

(/images/1/081319_1354_JavaSpringT20.png)

The following screen will be displayed:

/
(/images/1/081319_1354_JavaSpringT21.png)

Advantages of Spring Framework


Here, are important pros/ benefits of using spring.

Spring allows developers to develop enterprise-class applications with the help of


POJOs.
Offers templates for Hibernate, JDBC, Hibernate, JPA, etc. to reduce avoid writing
lengthy code.
Provides abstraction to Java Enterprise Edition (JEE).
You can organize a spring in a modular fashion. So that if a number of packages and
classes are substantial, you only need to about you need and ignore the rest.
It offers declarative support for transactions, formatting, validation, caching, etc.
The application developed using spring is simple as the environment-dependent code is
moved into this framework.

Disadvantages of Spring Framework


Here, are drawbacks/cons of Spring Framework.

Java spring offers too many restrictions.


Code is public is it is visible to all.
It also not offers custom-built features.

Summary: /
Spring framework is an easy to use open-source Java platform
Predefined templates and loose couple are important features of Java spring
Spring framework was written by Rod Johnson and was first released in June 2002
The Spring Framework provides 20 modules which can be used based on an application
requirement.
Java spring dispatcherServlet communicates with HandlerMapping. It also revokes
controller associated with that specific request.
Aspect-oriented programming allows the global properties of a program to decide how it
is compiled into an executable program.
The biggest advantage of Java Spring is that it allows developers to develop enterprise-
class applications with the help of POJOs
The biggest drawback of Java spring is that it offers too many restrictions.

 Prev (/groovy-tutorial.html) Report a Bug


Next  (/apache-ant-tutorial.html)

YOU MIGHT LIKE:

JAVA TUTORIALS JAVASCRIPT JAVA TUTORIALS

(/string-contains-method- (/difference-between- (/java-string-tolowercase-


java.html) (/string- java-and-javascript.html) methods.html)
contains-method- (/difference- (/java-string-
java.html) between-java-and- tolowercase-
String contains() Method in javascript.html) methods.html)
Java with Example Java vs JavaScript: Most Java String toLowercase()
(/string-contains-method- Important Di erences You and toUpperCase() Methods
java.html) Must Know (/java-string-tolowercase-
(/difference-between-java- methods.html)
and-javascript.html)

JAVA TUTORIALS JAVASCRIPT JAVA TUTORIALS

(/generate-random- (/javascript-unit-testing- (/prime-number-program-


number-java.html) frameworks.html) java.html) (/prime-
(/generate-random- (/javascript-unit- number-program-
number-java.html) testing-frameworks.html) java.html)
How to easily Generate JavaScript Unit Testing Prime Number From 1 to
Random Numbers in Java Frameworks 100 Program in Java

/
(/generate-random-number- (/javascript-unit-testing- (/prime-number-program-
java.html) frameworks.html) java.html)

Java Tutorials
48) Split a String (/how-to-split-a-string-in-java.html)

49) Buffered Reader (/buffered-reader-in-java.html)

50) Java Reflection API Tutorials (/java-reflection-api.html)

51) Java Tools for Developers (/java-tools.html)

52) Groovy Script Tutorial (/groovy-tutorial.html)

53) Java Spring Tutorial (/spring-tutorial.html)

54) Apache ANT Tutorial (/apache-ant-tutorial.html)

55) JasperReports Tutorial (/jasperreports-tutorial.html)

56) Check Prime Number (/java-program-check-prime-number.html)

57) Convert JSON to XML using Gson and JAXB (/json-to-xml-gson-jaxb.html)

58) Prime Number From 1 to 100 (/prime-number-program-java.html)

 (https://www.facebook.com/guru99com/)
 (https://twitter.com/guru99com) 
(https://www.linkedin.com/company/guru99/)

(https://www.youtube.com/channel/UC19i1XD6k88KqHlET8atqFQ)

(https://forms.aweber.com/form/46/724807646.htm)

About
About Us (/about-us.html)
Advertise with Us (/advertise-us.html)
Write For Us (/become-an-instructor.html)
Contact Us (/contact-us.html)

Career Suggestion

/
SAP Career Suggestion Tool (/best-sap-module.html)
Software Testing as a Career (/software-testing-career-
complete-guide.html)

Interesting
eBook (/ebook-pdf.html)
Blog (/blog/)
Quiz (/tests.html)
SAP eBook (/sap-ebook-pdf.html)

Execute online
Execute Java Online (/try-java-editor.html)
Execute Javascript (/execute-javascript-online.html)
Execute HTML (/execute-html-online.html)
Execute Python (/execute-python-online.html)

© Copyright - Guru99 2020


Privacy Policy (/privacy-policy.html) | Affiliate
Disclaimer (/affiliate-earning-disclaimer.html) | ToS
(/terms-of-service.html)

/
/

You might also like