SlideShare a Scribd company logo
1 of 39
Mohit Gupta
Spring MVC Framework
1. Framework
2. OOPS Concepts
3. Spring
4. JSP & Servlets
5. Loggers
6. ANT Tool
7. Web Services
Agenda
2
August 1, 2016
It is an essential supporting structure of a building,
vehicle,
enterprise a or object. In software, framework is used to
construct applications which basically are integrated
With each other
What is a Framework ?
A software framework is a re-usable
design for a software system.
Need of framework
Hotel Guest Hotel Owner
Hotel
Without Framework
With Framework
Hotel Owner
August 1, 2016
5
OOP Concepts since JAVA is a OOP
Language
August 1, 2016
6
August 1, 2016
7
Platform Independence
Spring Overview
• The Spring Framework is an open source application
framework and inversion of control container for
the Java platform.
• The framework's core features can be used by any Java
application
• Philosophy: “Lightweight Container” concept
Spring Overview
• Lightweight Frameworks simplify application development
• By removing re-occurring pattern code
• Productivity friendly
• Unit test friendly
• Very pluggable
• Usually open source
• Examples:
• Spring, Pico
• Hibernate, IBatis
What are Lightweight Frameworks?
Spring 3.0 MVC- Basic Architecture
Dispacth
erServlet
(Front controller)
HandlerMapping
(Map of URL and
controllers)
Controller
(Responsibl
e to handle
request)
View (JSP,
XML,
Velocity)
Model
(POJO
Beans)
Request
1
5
4
3
2
August 1, 2016
12
Flow diagram Spring framework
This framework has very loosely coupled components which are widely reusable
and are packaged separately.
Overview of the Spring Framework
The Spring Framework can be considered as a collection of frameworks-
in-the-framework:
1. Core - Inversion of Control (IoC) and Dependency Injection
2. AOP - Aspect-oriented programming
3. DAO - Data Access Object support, transaction management, JDBC-
abstraction
4. ORM - Object Relational Mapping technique for converting data b/w
incompatible type system in OOP language.
5. MVC - Model-View-Controller implementation for web-applications
6. Remote Access, Authentication and Authorization, Remote Management,
Messaging Framework, Web Services, Email, Testing, …
Modules of the Spring Framework
• Basic JavaBean pattern:
• include a “getter” and “setter” method for each field:
• Rather than locating needed resources, application components provide getter &
setter methods through which resources are passed in during initialization
• In Spring Framework, this pattern is used extensively, and initialization is usually
done through configuration file(web.xml) rather than application code
Bean
class MyBean {
private int counter;
public int getCounter()
{ return counter; }
public void setCounter(int counter)
{ this.counter = counter; }
}
• package player;
public class PersonBean implements java.io.Serializable {
private String name = null;
private boolean deceased = false;
public PersonBean() {
}
/* Getter for property */
public String getName() {
return name;
}
/**
* Setter for property */
public void setName(final String value) {
name = value;
}
/ * Getter for property "deceased"*/
public boolean isDeceased() {
return deceased;
}
/ * Setter for property */
public void setDeceased(final boolean value) {
deceased = value;
}
}
Example of BEAN Class
August 1, 2016
17
Bean
Autowiring feature of spring framework enables you to inject the object
dependency implicitly. It internally uses setter or constructor injection.
@Bean
@Bean is a method-level annotation and a direct analog of the
XML <bean/> element.
The annotation supports most of the attributes offered by <bean/> such as init-
method, destroy-method, autowiring.
@Configuration
public class AppConfig { @Bean publicTransferService transferService() { return new
TransferServiceImpl(); } }
The above is exactly equivalent to thefollowing appConfig.xml:
<beans><bean name="transferService" class="com.acme.TransferServiceImpl"/> </beans>
• Based on “Inversion of Control Containers and the Dependency Injection
pattern”
Spring Provides centralized, automated configuration, managing and wiring of
application Java objects.
• Container responsibilities:
1. creating objects,
2. configuring objects,
3. calling initialization methods
4. passing objects to registered callback objects
5. etc
• All together form the object lifecycle which is one of the most important
features
Dependency Injection -Inversion of
Control (IoC)
Dependency Injection-Container resolves (injects)
dependencies of components by setting implementation
object during runtime
Draw()
Triangle
During Implementation
Circle
• Beans define their dependencies through constructor arguments or properties
• Container resolves (injects) dependencies of components by setting
implementation object during the runtime
• BeanFactory interface – It is the core that
loads bean definitions and manages beans
• Most commonly used implementation
is the XmlBeanFactory class
• It allows you to express the objects that compose
application, and the interdependencies
between such objects, in terms of XML
• The XmlBeanFactory takes this XML
configuration metadata and uses it to create a fully configured system
Dependency Injection - IoC
• Spring address solutions to major J2EE problem areas:
• Web application development (MVC)
• Enterprise Java Beans (EJB, JNDI)  Annotations+ POJO
• Database access (JDBC,ORM)
• Transaction management ( Hibernate, JDBC)
• Remote access (Web Services, RMI)
Spring Solutions
Structure
Creating Spring MVC Application
Servlet
Contai
ner
August 1, 2016
24
August 1, 2016
25
August 1, 2016
26
• log4j is a reliable, fast and flexible logging
framework (APIs) written in Java, which is
distributed under the Apache Software License.
• log4j has three main components:
1. loggers: Responsible for capturing logging
information.
2. appenders: Responsible for publishing logging
information to various preferred destinations.
3. layouts: Responsible for formatting logging
information in different styles.
August 1, 2016
27
Logging in Java
August 1, 2016
28
Logging Levels
Level Description
ALL All levels including custom levels.
DEBUG Designates fine-grained informational events that are most useful to debug
an application.
ERROR Designates error events that might still allow the application to continue
running.
FATAL Designates very severe error events that will presumably lead the
application to abort.
INFO Designates informational messages that highlight the progress of the
application at coarse-grained level.
OFF The highest possible rank and is intended to turn off logging.
TRACE Designates finer-grained informational events than the DEBUG.
WARN Designates potentially harmful situations.
August 1, 2016
29
• All the possible options are:
1. DateLayout
2. HTMLLayout
3. PatternLayout
4. SimpleLayout
5. XMLLayout
• Using HTMLLayout and XMLLayout, you can generate log in HTML and in
XML format as well.
August 1, 2016
30
Types of Layouts
• ANT stands for Another Neat Tool. It is a Java-based build tool from
Apache.
• Need for a Build Tool (DEV OPS)
• On an average, a developer spends a substantial amount of time
doing mundane tasks like build and deployment that include:
• Compiling the code
• Packaging the binaries
• Deploying the binaries to the test server Testing the changes
• Copying the code from one location to another
• To automate and simplify the above tasks, Apache Ant is useful. It is
an Operating System build and deployment tool that can be executed
from the command line.
August 1, 2016
31
ANT-Build Tool
August 1, 2016
32
What is the use of the build.xml file?
The build.xml file is an Ant script that is created by the Plug-in Development Environment (PDE) to
take your plug-in components and combine them into a deployable format.
This file compiles and archives your plug-in source code into a single JAR file.
The build.properties file controls what goes into your plug-in distribution.
The build.xml file can be created by using the context menu on plugin.xml and selecting PDE Tools >
Create Ant Build File.
Ant build files are low-level mechanisms to package up plug-ins. A much easier way to share and
deploy plug-ins is to create a feature for your plug-in and then an update site.
• The build path is used for building your application. It
contains all of your source files and all Java libraries
that are required to compile the application.
• The classpath is used for executing the application.
This includes all java classes and libraries that are
needed to run the java application. A Classpath is
mandatory, the default path is . which is used if the
java virtual machine can't find a user defined path.
August 1, 2016
33
Build path vs Class Path
 JAR
EJB modules which contains enterprise java beans class files
and EJB deployment descriptor are packed as JAR files with
.jar extenstion
 WAR
Web modules which contains Servlet class files,JSP
FIles,supporting files, GIF and HTML files are packaged as
JAR file with .war( web achive) extension
 EAR
All above files(.jar and .war) are packaged as JAR file with
.ear ( enterprise archive) extension and deployed into
Application Server.
August 1, 2016
34
What is the difference between EAR, JAR and
WAR file
August 1, 2016
35
August 1, 2016
36
Web service is a technology to communicate one
programming language with another. For example, java
programming language can interact with PHP and .Net by
using web services. In other words, web service provides a
way to achieve interoperability.
SOAP & REST Webservices
WEB SERVICES
• Controller is separated from Model
• View is separated from Model (View can be seen
on any type of UI-Mobile ,desktop etc)
• View is separated from Controller
• There are different types of MVC Frameworks
• Each is used as per unique requirement
• Popular:-Spring,Struts,Hibernate,JSF
August 1, 2016
37
Advantages Of MVC Framework
• Enable you to write powerful, scalable applications using POJOs
• Lifecycle – responsible for managing all your application components, particularly those in
the middle tier container sees components through well-defined lifecycle: init(), destroy()
• Dependencies - Spring handles injecting dependent components without a component
knowing where they came from (IoC)
• Configuration information - Spring provides one consistent way of configuring everything,
separate configuration from application logic, varying configuration
• In J2EE (e.g. EJB) it is easy to become dependent on container and deployment
environment; Spring eliminates them
• Portable (can use server-side in web/ejb app, client-side in swing app, business logic is
completely portable)
Advantages of Spring Architecture
• Thank You
August 1, 2016

More Related Content

What's hot

Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkRaveendra R
 
Building web applications with Java & Spring
Building web applications with Java & SpringBuilding web applications with Java & Spring
Building web applications with Java & SpringDavid Kiss
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCFunnelll
 
Spring framework in depth
Spring framework in depthSpring framework in depth
Spring framework in depthVinay Kumar
 
Introduction to Ibatis by Rohit
Introduction to Ibatis by RohitIntroduction to Ibatis by Rohit
Introduction to Ibatis by RohitRohit Prabhakar
 
Spring introduction
Spring introductionSpring introduction
Spring introductionManav Prasad
 
Spring bean mod02
Spring bean mod02Spring bean mod02
Spring bean mod02Guo Albert
 
Spring Framework
Spring FrameworkSpring Framework
Spring Frameworknomykk
 
Spring framework
Spring frameworkSpring framework
Spring frameworkAircon Chen
 

What's hot (18)

Java spring ppt
Java spring pptJava spring ppt
Java spring ppt
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Building web applications with Java & Spring
Building web applications with Java & SpringBuilding web applications with Java & Spring
Building web applications with Java & Spring
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoC
 
Java Spring Framework
Java Spring FrameworkJava Spring Framework
Java Spring Framework
 
Next stop: Spring 4
Next stop: Spring 4Next stop: Spring 4
Next stop: Spring 4
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Spring framework in depth
Spring framework in depthSpring framework in depth
Spring framework in depth
 
Introduction to Ibatis by Rohit
Introduction to Ibatis by RohitIntroduction to Ibatis by Rohit
Introduction to Ibatis by Rohit
 
Spring introduction
Spring introductionSpring introduction
Spring introduction
 
Spring boot jpa
Spring boot jpaSpring boot jpa
Spring boot jpa
 
Spring bean mod02
Spring bean mod02Spring bean mod02
Spring bean mod02
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Reactjs Basics
Reactjs BasicsReactjs Basics
Reactjs Basics
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
Maven
MavenMaven
Maven
 

Similar to Spring MVC framework

Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.suranisaunak
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsmichaelaaron25322
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworksMukesh Kumar
 
Spring framework Introduction
Spring framework  IntroductionSpring framework  Introduction
Spring framework IntroductionAnuj Singh Rajput
 
Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to SpringSujit Kumar
 
Project report for final year project
Project report for final year projectProject report for final year project
Project report for final year projectsuneel singh
 
Integrating Splunk into your Spring Applications
Integrating Splunk into your Spring ApplicationsIntegrating Splunk into your Spring Applications
Integrating Splunk into your Spring ApplicationsDamien Dallimore
 
Lecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfLecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfShaimaaMohamedGalal
 
Monoliths are so 2001 – What you need is Modularity
Monoliths are so 2001 – What you need is ModularityMonoliths are so 2001 – What you need is Modularity
Monoliths are so 2001 – What you need is ModularityGraham Charters
 
Spring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggetsSpring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggetsVirtual Nuggets
 
Spring intro classes-in-mumbai
Spring intro classes-in-mumbaiSpring intro classes-in-mumbai
Spring intro classes-in-mumbaivibrantuser
 
OSGi enRoute Unveiled - P Kriens
OSGi enRoute Unveiled - P KriensOSGi enRoute Unveiled - P Kriens
OSGi enRoute Unveiled - P Kriensmfrancis
 
Building and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowBuilding and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowKaxil Naik
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkDineesha Suraweera
 

Similar to Spring MVC framework (20)

Introduction to Spring & Spring BootFramework
Introduction to Spring  & Spring BootFrameworkIntroduction to Spring  & Spring BootFramework
Introduction to Spring & Spring BootFramework
 
Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.
 
Spring notes
Spring notesSpring notes
Spring notes
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applications
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
 
Spring
SpringSpring
Spring
 
Spring framework Introduction
Spring framework  IntroductionSpring framework  Introduction
Spring framework Introduction
 
java slides
java slidesjava slides
java slides
 
Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to Spring
 
Spring Basics
Spring BasicsSpring Basics
Spring Basics
 
Project report for final year project
Project report for final year projectProject report for final year project
Project report for final year project
 
Integrating Splunk into your Spring Applications
Integrating Splunk into your Spring ApplicationsIntegrating Splunk into your Spring Applications
Integrating Splunk into your Spring Applications
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Lecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfLecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdf
 
Monoliths are so 2001 – What you need is Modularity
Monoliths are so 2001 – What you need is ModularityMonoliths are so 2001 – What you need is Modularity
Monoliths are so 2001 – What you need is Modularity
 
Spring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggetsSpring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggets
 
Spring intro classes-in-mumbai
Spring intro classes-in-mumbaiSpring intro classes-in-mumbai
Spring intro classes-in-mumbai
 
OSGi enRoute Unveiled - P Kriens
OSGi enRoute Unveiled - P KriensOSGi enRoute Unveiled - P Kriens
OSGi enRoute Unveiled - P Kriens
 
Building and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowBuilding and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache Airflow
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 

Recently uploaded

MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 

Recently uploaded (20)

MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 

Spring MVC framework

  • 2. 1. Framework 2. OOPS Concepts 3. Spring 4. JSP & Servlets 5. Loggers 6. ANT Tool 7. Web Services Agenda 2 August 1, 2016
  • 3. It is an essential supporting structure of a building, vehicle, enterprise a or object. In software, framework is used to construct applications which basically are integrated With each other What is a Framework ? A software framework is a re-usable design for a software system.
  • 4. Need of framework Hotel Guest Hotel Owner Hotel Without Framework With Framework Hotel Owner
  • 5. August 1, 2016 5 OOP Concepts since JAVA is a OOP Language
  • 9. • The Spring Framework is an open source application framework and inversion of control container for the Java platform. • The framework's core features can be used by any Java application • Philosophy: “Lightweight Container” concept Spring Overview
  • 10. • Lightweight Frameworks simplify application development • By removing re-occurring pattern code • Productivity friendly • Unit test friendly • Very pluggable • Usually open source • Examples: • Spring, Pico • Hibernate, IBatis What are Lightweight Frameworks?
  • 11. Spring 3.0 MVC- Basic Architecture Dispacth erServlet (Front controller) HandlerMapping (Map of URL and controllers) Controller (Responsibl e to handle request) View (JSP, XML, Velocity) Model (POJO Beans) Request 1 5 4 3 2
  • 12. August 1, 2016 12 Flow diagram Spring framework
  • 13. This framework has very loosely coupled components which are widely reusable and are packaged separately. Overview of the Spring Framework
  • 14. The Spring Framework can be considered as a collection of frameworks- in-the-framework: 1. Core - Inversion of Control (IoC) and Dependency Injection 2. AOP - Aspect-oriented programming 3. DAO - Data Access Object support, transaction management, JDBC- abstraction 4. ORM - Object Relational Mapping technique for converting data b/w incompatible type system in OOP language. 5. MVC - Model-View-Controller implementation for web-applications 6. Remote Access, Authentication and Authorization, Remote Management, Messaging Framework, Web Services, Email, Testing, … Modules of the Spring Framework
  • 15. • Basic JavaBean pattern: • include a “getter” and “setter” method for each field: • Rather than locating needed resources, application components provide getter & setter methods through which resources are passed in during initialization • In Spring Framework, this pattern is used extensively, and initialization is usually done through configuration file(web.xml) rather than application code Bean class MyBean { private int counter; public int getCounter() { return counter; } public void setCounter(int counter) { this.counter = counter; } }
  • 16. • package player; public class PersonBean implements java.io.Serializable { private String name = null; private boolean deceased = false; public PersonBean() { } /* Getter for property */ public String getName() { return name; } /** * Setter for property */ public void setName(final String value) { name = value; } / * Getter for property "deceased"*/ public boolean isDeceased() { return deceased; } / * Setter for property */ public void setDeceased(final boolean value) { deceased = value; } } Example of BEAN Class
  • 17. August 1, 2016 17 Bean Autowiring feature of spring framework enables you to inject the object dependency implicitly. It internally uses setter or constructor injection. @Bean @Bean is a method-level annotation and a direct analog of the XML <bean/> element. The annotation supports most of the attributes offered by <bean/> such as init- method, destroy-method, autowiring. @Configuration public class AppConfig { @Bean publicTransferService transferService() { return new TransferServiceImpl(); } } The above is exactly equivalent to thefollowing appConfig.xml: <beans><bean name="transferService" class="com.acme.TransferServiceImpl"/> </beans>
  • 18. • Based on “Inversion of Control Containers and the Dependency Injection pattern” Spring Provides centralized, automated configuration, managing and wiring of application Java objects. • Container responsibilities: 1. creating objects, 2. configuring objects, 3. calling initialization methods 4. passing objects to registered callback objects 5. etc • All together form the object lifecycle which is one of the most important features Dependency Injection -Inversion of Control (IoC)
  • 19. Dependency Injection-Container resolves (injects) dependencies of components by setting implementation object during runtime Draw() Triangle During Implementation Circle
  • 20. • Beans define their dependencies through constructor arguments or properties • Container resolves (injects) dependencies of components by setting implementation object during the runtime • BeanFactory interface – It is the core that loads bean definitions and manages beans • Most commonly used implementation is the XmlBeanFactory class • It allows you to express the objects that compose application, and the interdependencies between such objects, in terms of XML • The XmlBeanFactory takes this XML configuration metadata and uses it to create a fully configured system Dependency Injection - IoC
  • 21. • Spring address solutions to major J2EE problem areas: • Web application development (MVC) • Enterprise Java Beans (EJB, JNDI)  Annotations+ POJO • Database access (JDBC,ORM) • Transaction management ( Hibernate, JDBC) • Remote access (Web Services, RMI) Spring Solutions
  • 23. Creating Spring MVC Application
  • 27. • log4j is a reliable, fast and flexible logging framework (APIs) written in Java, which is distributed under the Apache Software License. • log4j has three main components: 1. loggers: Responsible for capturing logging information. 2. appenders: Responsible for publishing logging information to various preferred destinations. 3. layouts: Responsible for formatting logging information in different styles. August 1, 2016 27 Logging in Java
  • 28. August 1, 2016 28 Logging Levels Level Description ALL All levels including custom levels. DEBUG Designates fine-grained informational events that are most useful to debug an application. ERROR Designates error events that might still allow the application to continue running. FATAL Designates very severe error events that will presumably lead the application to abort. INFO Designates informational messages that highlight the progress of the application at coarse-grained level. OFF The highest possible rank and is intended to turn off logging. TRACE Designates finer-grained informational events than the DEBUG. WARN Designates potentially harmful situations.
  • 30. • All the possible options are: 1. DateLayout 2. HTMLLayout 3. PatternLayout 4. SimpleLayout 5. XMLLayout • Using HTMLLayout and XMLLayout, you can generate log in HTML and in XML format as well. August 1, 2016 30 Types of Layouts
  • 31. • ANT stands for Another Neat Tool. It is a Java-based build tool from Apache. • Need for a Build Tool (DEV OPS) • On an average, a developer spends a substantial amount of time doing mundane tasks like build and deployment that include: • Compiling the code • Packaging the binaries • Deploying the binaries to the test server Testing the changes • Copying the code from one location to another • To automate and simplify the above tasks, Apache Ant is useful. It is an Operating System build and deployment tool that can be executed from the command line. August 1, 2016 31 ANT-Build Tool
  • 32. August 1, 2016 32 What is the use of the build.xml file? The build.xml file is an Ant script that is created by the Plug-in Development Environment (PDE) to take your plug-in components and combine them into a deployable format. This file compiles and archives your plug-in source code into a single JAR file. The build.properties file controls what goes into your plug-in distribution. The build.xml file can be created by using the context menu on plugin.xml and selecting PDE Tools > Create Ant Build File. Ant build files are low-level mechanisms to package up plug-ins. A much easier way to share and deploy plug-ins is to create a feature for your plug-in and then an update site.
  • 33. • The build path is used for building your application. It contains all of your source files and all Java libraries that are required to compile the application. • The classpath is used for executing the application. This includes all java classes and libraries that are needed to run the java application. A Classpath is mandatory, the default path is . which is used if the java virtual machine can't find a user defined path. August 1, 2016 33 Build path vs Class Path
  • 34.  JAR EJB modules which contains enterprise java beans class files and EJB deployment descriptor are packed as JAR files with .jar extenstion  WAR Web modules which contains Servlet class files,JSP FIles,supporting files, GIF and HTML files are packaged as JAR file with .war( web achive) extension  EAR All above files(.jar and .war) are packaged as JAR file with .ear ( enterprise archive) extension and deployed into Application Server. August 1, 2016 34 What is the difference between EAR, JAR and WAR file
  • 36. August 1, 2016 36 Web service is a technology to communicate one programming language with another. For example, java programming language can interact with PHP and .Net by using web services. In other words, web service provides a way to achieve interoperability. SOAP & REST Webservices WEB SERVICES
  • 37. • Controller is separated from Model • View is separated from Model (View can be seen on any type of UI-Mobile ,desktop etc) • View is separated from Controller • There are different types of MVC Frameworks • Each is used as per unique requirement • Popular:-Spring,Struts,Hibernate,JSF August 1, 2016 37 Advantages Of MVC Framework
  • 38. • Enable you to write powerful, scalable applications using POJOs • Lifecycle – responsible for managing all your application components, particularly those in the middle tier container sees components through well-defined lifecycle: init(), destroy() • Dependencies - Spring handles injecting dependent components without a component knowing where they came from (IoC) • Configuration information - Spring provides one consistent way of configuring everything, separate configuration from application logic, varying configuration • In J2EE (e.g. EJB) it is easy to become dependent on container and deployment environment; Spring eliminates them • Portable (can use server-side in web/ejb app, client-side in swing app, business logic is completely portable) Advantages of Spring Architecture