+ All Categories
Home > Technology > Building Web Application Using Spring Framework

Building Web Application Using Spring Framework

Date post: 16-Aug-2015
Category:
Upload: edureka
View: 745 times
Download: 0 times
Share this document with a friend
21
Building Web Application Using Spring Framework View Spring Framework course details at www.edureka.co/spring-framework For Queries: Post on Twitter @edurekaIN: #askEdureka Post on Facebook /edurekaIN For more details please contact us: US : 1800 275 9730 (toll free) INDIA : +91 88808 62004 Email Us : [email protected]
Transcript

Building Web Application Using Spring Framework

View Spring Framework course details at www.edureka.co/spring-framework

For Queries:Post on Twitter @edurekaIN: #askEdurekaPost on Facebook /edurekaIN

For more details please contact us: US : 1800 275 9730 (toll free)INDIA : +91 88808 62004Email Us : [email protected]

Slide 2 www.edureka.co/spring-framework

At the end of this module, you will be able to understand:

Objectives

Introduction to Spring and its Architecture

Dependency Injection

Spring MVC Architecture

Exception Handling With Spring MVC

Build a Web Application using Spring

Slide 3 www.edureka.co/spring-framework

In Java technology there are many frameworks that helps the programmers to easily build complex applications

You can choose these frameworks for building your applications

Example:

» Hibernate Database access mechanism» Struts Web Layer» EJBs Services like transactions, security & messaging» Log4J Logging

Java Frameworks!!!

Slide 4 www.edureka.co/spring-framework

Problem:

» Applications that use the varied frameworks and services are difficult to maintain as they grow

Need:

» Applications that use a number of frameworks and services have to remain maintainable

» Codes should be loosely coupled with the frameworks so that testing and reusability becomes easy

Java Frameworks!!!

Slide 5 www.edureka.co/spring-framework

Spring Framework provides a light-weight solution to develop maintainable and reusable enterprise applications

It provides very simple and rich facilities to integrate various frameworks, technologies and services in the application

Spring Framework!!!

Slide 6 www.edureka.co/spring-framework

AOP Aspects Instrumentation

Test

JDBC ORM

OXM JMS

Transactions

Web Servlet

Portlet Struts

Beans Core ContextExpression Language

Core Container

WEB (MVC/Remoting)Data Access/Integration

Spring Framework Runtime

Spring Architecture

Slide 7 www.edureka.co/spring-framework

Dependency Injection

Spring XML

Object

Spring Bean

Spring Bean

Bean Factory

Slide 8 www.edureka.co/spring-framework

Objects created by the container are also called managed objects or beans

The container can be configured by loading XML files or detecting specific Java annotations on configuration classes

Central to the Spring Framework is its inversion of control (IoC) container, which provides a consistent means of configuring and managing Java objects

The container is responsible for managing object lifecycles of specific objects: creating these objects, calling their initialization methods, and configuring these objects by wiring them together

Dependency Injection

Slide 9 www.edureka.co/spring-framework

There are two ways to perform Dependency Injection :

Setter Method Dependency Injection(DI) - In this type of DI the required bean is injected through setter method for that bean

Constructor Dependency Injection(DI) - In this type of DI the required bean is injected through the constructor argument

Types of Dependency Injection

Slide 10 www.edureka.co/spring-framework

Model-View-Controller architecture is used for interactive web-applications. This model minimizes the coupling between business logic and data presentation to web user. This model divides the web based application into three layers:

» Model: Model domain contains the business logics and functions that manipulate the business data. It provides updated information to view domain and also gives response to a query. And the controller can access the functionality which is encapsulated in the model

» View: View is responsible for presentation aspect of application according to the model data and also responsible to forward query response to the controller

» Controller: Controller accepts and intercepts user requests and controls the business objects to fulfil these requests. An application has one controller for related functionality. Controller can also be depends on the type of clients

Model-View-Controller (MVC)

Slide 11 www.edureka.co/spring-framework

MVC

View Model

Controller

UI Logic Business Logic

Request & Relay Data

Slide 12 www.edureka.co/spring-framework

Spring MVC

Slide 13 www.edureka.co/spring-framework

Setting Up Spring MVC

Slide 14 www.edureka.co/spring-framework

Spring MVC provides a great way to handle exceptions and errors

@ExceptionHandler annotation is core to this feature

For each Spring controller we can simply define a method that automatically gets called if a given exception occurs

So any error resulting in ClassNotFoundException will lead to classNotFoundError.jsp page rather than displaying the error logs to user.

Exception Handling with Spring MVC

Slide 15 www.edureka.co/spring-framework

One of the shortcomings of @ExceptionHandler is it only handles exception getting raised from the controller where it is defined. It will not handle exceptions getting raised from other controllers

Now this will take care of ClassNotFoundException thrown from any controller and will show classNotFoundError.jsp page

@ControllerAdvice

Slide 16 www.edureka.co/spring-framework

Building a Web Application Using Spring

Slide 17 www.edureka.co/spring-framework

Spring - Job Trends

LIVE Online Class

Class Recording in LMS

24/7 Post Class Support

Module Wise Quiz

Project Work

Verifiable Certificate

Slide 18 www.edureka.co/spring-framework

How it Works?

Slide 19 www.edureka.co/spring-framework

Module 1 » Introduction to Spring

Module 2» Spring Configurations

Module 3 » Aspect Oriented Programming and DAO

Module 4 » Data Access

Module 5» Spring Web

Module 6» Integrating Struts 2, JSF with Spring, Spring

Web Flow

Module 7» Spring Security

Module 8» Spring Integration

Course Topics

Questions

Slide 20 www.edureka.co/spring-framework


Recommended