SlideShare una empresa de Scribd logo
1 de 22
Overview of Spring Framework

            Rajeev Gupta
             M. Tech. CS




          rgupta.trainer@gmail.com
Objective

•   Introduction to Spring framework
•   Spring module
•   Spring architecture
•   Introduction to DI
•   Introduction to AOP



                   rgupta.trainer@gmail.com
Spring Framework
• Spring Framework is focused on simplifying
  enterprise Java development through
  1. dependency injection
  2. aspect-oriented programming
  3. boiler-plate reduction.




                   rgupta.trainer@gmail.com
Spring Modules

DAO         ORM                    JEE   Web




      AOP



                      Core




            rgupta.trainer@gmail.com
Bean
• Objects that are managed by the Spring container are
  called beans.

• A bean is an object that is instantiated, assembled, and
  otherwise managed by a Spring IoC container.

• Beans, and the dependencies among them, are reflected in
  the configuration metadata used by a container.

   – BeanFactory provides the configuration framework and basic
     functionality, and the

   – ApplicationContext adds more enterprise-specific functionality

                          rgupta.trainer@gmail.com
CORE SPRING CONTAINER
• Container manages how the beans in a Spring-enabled
  application are created, configured, and managed.

• Within this module you’ll find the Spring bean factory,
  which is the portion of Spring that provides
  dependency injection.

• In addition to the bean factory and application context,
  this module also supplies many enterprise services
  such as email, JNDI access, EJB integration, and
  scheduling.
                       rgupta.trainer@gmail.com
SPRING’S AOP MODULE
• AOP module serves as the basis for developing
  your own aspects for your Spring-enabled
  application.

• Like DI, AOP supports loose coupling of
  application objects.

• But with AOP, application-wide concerns (such as
  transactions and security) are decoupled from
  the objects to which they’re applied.

                    rgupta.trainer@gmail.com
DATA ACCESS DAO
• Spring’s template-based JDBC abstraction can greatly
  simplify JDBC code

• This module also builds a layer of meaningful exceptions on
  top of the error messages given by several database
  servers.

• Spring provide hooks into several popular ORM
  frameworks, including Hibernate, Java Persistence API, Java
  Data Objects, and iBATIS SQL Maps.

• Spring’s AOP module provide transaction management
  services for objects in a Spring application
                        rgupta.trainer@gmail.com
WEB AND REMOTING
• Spring provide capable MVC framework that promotes
  Spring’s loosely coupled techniques in the web layer of
  an application

• This framework comes in two forms:
         – a servlet-based framework
                   • for conventional web applications and
         – portlet-based application
                   • for developing against the Java portlet API.



• Spring has remoting capabilities include Remote
  Method Invocation (RMI), JAX-WS
                             rgupta.trainer@gmail.com
What is Spring?
  Spring is a container and it manages the lifecycle and
    configuration of application object i.e. called Spring
                           beans

This make spring a container running within an container
  (ie JVM or web container)

Spring is supposed to less complex framework then
  provided by framework such as EJB

Thus bean is less complex EJB!!!

                       rgupta.trainer@gmail.com
Spring as an container…




        rgupta.trainer@gmail.com
In a Spring application, objects are created, wired
  together, and live within the Spring container
                    rgupta.trainer@gmail.com
In a Spring application, objects are created, wired
  together, and live within the Spring container
                    rgupta.trainer@gmail.com
• In a Spring-based application, your application objects will live within the
  Spring container.

• Container will create the objects, wire them together, configure them, and
  manage their complete lifecycle from cradle to grave (or new to finalize(),
  as the case may be).

• The container is at the core of the Spring Framework.

• Spring’s container uses dependency injection (DI) to manage the
  components that make up an application.

• This includes creating associations between collaborating components. As
  such, these objects are cleaner and easier to understand, support reuse,
  and are easy to unit test


                               rgupta.trainer@gmail.com
Two important bean containers
• org.springframework.beans.factory.BeanFactory
• org.springframework.context.ApplicationContext




                       rgupta.trainer@gmail.com
Two type of container

• Bean factories
      • defined by the org.springframework.beans.factory.BeanFactory
        interface) are the simplest of containers.
      • Bean factories provides basic support for DI.


• Application contexts
      • defined by the org.springframework.context.ApplicationContext
        interface.
      • Application context build on the notion of a bean factory by
        providing application framework services, such as the ability to
        resolve textual messages from a properties file and the ability to
        publish application events to interested event listeners

                            rgupta.trainer@gmail.com
BeanFactory
• Factory design pattern.



BeanFactory factory =new XmlBeanFactory(new
  FileSystemResource(“e:/spring/beans.xml"));




                        rgupta.trainer@gmail.com
ApplicationContext
An application context gives more:
• Support for I18N(Internationalization) for
  messages.
• Provides generic way to load resources.
• Publish events to beans registered as events.




                   rgupta.trainer@gmail.com
ApplicationContext
• ClassPathXmlApplicationContext - XML file
  located in the classpath
• FileSystemXmlApplicationContext - XML file in
  the file system
• XmlWebApplicationContext - XML file
   contained within a web application



                   rgupta.trainer@gmail.com
ApplicationContext
• ApplicationContext context = new
  FileSystemXmlApplicationContext("c:/foo.xml");

• ApplicationContext context = new
  ClassPathXmlApplicationContext("foo.xml");




                     rgupta.trainer@gmail.com
Beans Life cycle




     rgupta.trainer@gmail.com
              Above Figure is from Spring in action book, Manning publications
ApplicationContext – Bean Life Cycle




                               Above Figure is from Spring in action book, Manning
              rgupta.trainer@gmail.com
                               publications

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans
 
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
 
Spring framework in depth
Spring framework in depthSpring framework in depth
Spring framework in depth
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring framework Introduction
Spring framework IntroductionSpring framework Introduction
Spring framework Introduction
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Spring jdbc
Spring jdbcSpring jdbc
Spring jdbc
 
Spring User Guide
Spring User GuideSpring User Guide
Spring User Guide
 
Java Spring Framework
Java Spring FrameworkJava Spring Framework
Java Spring Framework
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Spring boot jpa
Spring boot jpaSpring boot jpa
Spring boot jpa
 

Destacado

Introduction To Core Java - SpringPeople
Introduction To Core Java - SpringPeopleIntroduction To Core Java - SpringPeople
Introduction To Core Java - SpringPeopleSpringPeople
 
SpringPeople Introduction to Spring Framework
SpringPeople Introduction to Spring FrameworkSpringPeople Introduction to Spring Framework
SpringPeople Introduction to Spring FrameworkSpringPeople
 
SpringFramework Overview
SpringFramework OverviewSpringFramework Overview
SpringFramework Overviewzerovirus23
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Tuna Tore
 
Silk Performer Presentation v1
Silk Performer Presentation v1Silk Performer Presentation v1
Silk Performer Presentation v1Sun Technlogies
 

Destacado (6)

Introduction To Core Java - SpringPeople
Introduction To Core Java - SpringPeopleIntroduction To Core Java - SpringPeople
Introduction To Core Java - SpringPeople
 
SpringPeople Introduction to Spring Framework
SpringPeople Introduction to Spring FrameworkSpringPeople Introduction to Spring Framework
SpringPeople Introduction to Spring Framework
 
SpringFramework Overview
SpringFramework OverviewSpringFramework Overview
SpringFramework Overview
 
Core java
Core javaCore java
Core java
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
 
Silk Performer Presentation v1
Silk Performer Presentation v1Silk Performer Presentation v1
Silk Performer Presentation v1
 

Similar a Java spring framework

Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to SpringSujit Kumar
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC frameworkMohit Gupta
 
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 Basics
Spring BasicsSpring Basics
Spring BasicsEmprovise
 
spring framework ppt by Rohit malav
spring framework ppt by Rohit malavspring framework ppt by Rohit malav
spring framework ppt by Rohit malavRohit malav
 
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of ControlJava Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of ControlArjun Thakur
 
Spring - CDI Interop
Spring - CDI InteropSpring - CDI Interop
Spring - CDI InteropRay Ploski
 
Spring (1)
Spring (1)Spring (1)
Spring (1)Aneega
 
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache TomcatCase Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache TomcatVMware Hyperic
 
Spring framework-tutorial
Spring framework-tutorialSpring framework-tutorial
Spring framework-tutorialvinayiqbusiness
 
Spring Framework Presantation Part 1-Core
Spring Framework Presantation Part 1-CoreSpring Framework Presantation Part 1-Core
Spring Framework Presantation Part 1-CoreDonald Lika
 
스프링 프레임워크
스프링 프레임워크스프링 프레임워크
스프링 프레임워크Yoonki Chang
 

Similar a Java spring framework (20)

Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to Spring
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC framework
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
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 session
Spring sessionSpring session
Spring session
 
Introduction to Spring & Spring BootFramework
Introduction to Spring  & Spring BootFrameworkIntroduction to Spring  & Spring BootFramework
Introduction to Spring & Spring BootFramework
 
Spring Basics
Spring BasicsSpring Basics
Spring Basics
 
spring framework ppt by Rohit malav
spring framework ppt by Rohit malavspring framework ppt by Rohit malav
spring framework ppt by Rohit malav
 
Spring 2
Spring 2Spring 2
Spring 2
 
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of ControlJava Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
 
Java Spring
Java SpringJava Spring
Java Spring
 
Java spring ppt
Java spring pptJava spring ppt
Java spring ppt
 
Spring - CDI Interop
Spring - CDI InteropSpring - CDI Interop
Spring - CDI Interop
 
Spring (1)
Spring (1)Spring (1)
Spring (1)
 
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache TomcatCase Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
 
Spring framework-tutorial
Spring framework-tutorialSpring framework-tutorial
Spring framework-tutorial
 
Spring Framework Presantation Part 1-Core
Spring Framework Presantation Part 1-CoreSpring Framework Presantation Part 1-Core
Spring Framework Presantation Part 1-Core
 
Hybernat and structs, spring classes in mumbai
Hybernat and structs, spring classes in mumbaiHybernat and structs, spring classes in mumbai
Hybernat and structs, spring classes in mumbai
 
스프링 프레임워크
스프링 프레임워크스프링 프레임워크
스프링 프레임워크
 

Más de Rajiv Gupta

Spring5 hibernate5 security5 lab step by step
Spring5 hibernate5 security5 lab step by stepSpring5 hibernate5 security5 lab step by step
Spring5 hibernate5 security5 lab step by stepRajiv Gupta
 
GOF Design pattern with java
GOF Design pattern with javaGOF Design pattern with java
GOF Design pattern with javaRajiv Gupta
 
1. java script language fundamentals
1. java script language fundamentals1. java script language fundamentals
1. java script language fundamentalsRajiv Gupta
 
Introduction to jsf2
Introduction to jsf2Introduction to jsf2
Introduction to jsf2Rajiv Gupta
 
Weblogic 11g admin basic with screencast
Weblogic 11g admin basic with screencastWeblogic 11g admin basic with screencast
Weblogic 11g admin basic with screencastRajiv Gupta
 
Lab work servlets and jsp
Lab work servlets and jspLab work servlets and jsp
Lab work servlets and jspRajiv Gupta
 
Spring aop with aspect j
Spring aop with aspect jSpring aop with aspect j
Spring aop with aspect jRajiv Gupta
 
Spring 3.0 dependancy injection
Spring 3.0 dependancy injectionSpring 3.0 dependancy injection
Spring 3.0 dependancy injectionRajiv Gupta
 
Java Logging discussion Log4j,Slf4j
Java Logging discussion Log4j,Slf4jJava Logging discussion Log4j,Slf4j
Java Logging discussion Log4j,Slf4jRajiv Gupta
 
Advance C++notes
Advance C++notesAdvance C++notes
Advance C++notesRajiv Gupta
 
Core java 5 days workshop stuff
Core java 5 days workshop stuffCore java 5 days workshop stuff
Core java 5 days workshop stuffRajiv Gupta
 

Más de Rajiv Gupta (18)

Spring5 hibernate5 security5 lab step by step
Spring5 hibernate5 security5 lab step by stepSpring5 hibernate5 security5 lab step by step
Spring5 hibernate5 security5 lab step by step
 
GOF Design pattern with java
GOF Design pattern with javaGOF Design pattern with java
GOF Design pattern with java
 
1. java script language fundamentals
1. java script language fundamentals1. java script language fundamentals
1. java script language fundamentals
 
Introduction to jsf2
Introduction to jsf2Introduction to jsf2
Introduction to jsf2
 
Hibernate 3
Hibernate 3Hibernate 3
Hibernate 3
 
Weblogic 11g admin basic with screencast
Weblogic 11g admin basic with screencastWeblogic 11g admin basic with screencast
Weblogic 11g admin basic with screencast
 
Struts2
Struts2Struts2
Struts2
 
jsf2 Notes
jsf2 Notesjsf2 Notes
jsf2 Notes
 
Java 7
Java 7Java 7
Java 7
 
Struts2 notes
Struts2 notesStruts2 notes
Struts2 notes
 
Lab work servlets and jsp
Lab work servlets and jspLab work servlets and jsp
Lab work servlets and jsp
 
Java Servlet
Java Servlet Java Servlet
Java Servlet
 
Spring aop with aspect j
Spring aop with aspect jSpring aop with aspect j
Spring aop with aspect j
 
Spring 3.0 dependancy injection
Spring 3.0 dependancy injectionSpring 3.0 dependancy injection
Spring 3.0 dependancy injection
 
Jsp Notes
Jsp NotesJsp Notes
Jsp Notes
 
Java Logging discussion Log4j,Slf4j
Java Logging discussion Log4j,Slf4jJava Logging discussion Log4j,Slf4j
Java Logging discussion Log4j,Slf4j
 
Advance C++notes
Advance C++notesAdvance C++notes
Advance C++notes
 
Core java 5 days workshop stuff
Core java 5 days workshop stuffCore java 5 days workshop stuff
Core java 5 days workshop stuff
 

Último

ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 

Último (20)

ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 

Java spring framework

  • 1. Overview of Spring Framework Rajeev Gupta M. Tech. CS rgupta.trainer@gmail.com
  • 2. Objective • Introduction to Spring framework • Spring module • Spring architecture • Introduction to DI • Introduction to AOP rgupta.trainer@gmail.com
  • 3. Spring Framework • Spring Framework is focused on simplifying enterprise Java development through 1. dependency injection 2. aspect-oriented programming 3. boiler-plate reduction. rgupta.trainer@gmail.com
  • 4. Spring Modules DAO ORM JEE Web AOP Core rgupta.trainer@gmail.com
  • 5. Bean • Objects that are managed by the Spring container are called beans. • A bean is an object that is instantiated, assembled, and otherwise managed by a Spring IoC container. • Beans, and the dependencies among them, are reflected in the configuration metadata used by a container. – BeanFactory provides the configuration framework and basic functionality, and the – ApplicationContext adds more enterprise-specific functionality rgupta.trainer@gmail.com
  • 6. CORE SPRING CONTAINER • Container manages how the beans in a Spring-enabled application are created, configured, and managed. • Within this module you’ll find the Spring bean factory, which is the portion of Spring that provides dependency injection. • In addition to the bean factory and application context, this module also supplies many enterprise services such as email, JNDI access, EJB integration, and scheduling. rgupta.trainer@gmail.com
  • 7. SPRING’S AOP MODULE • AOP module serves as the basis for developing your own aspects for your Spring-enabled application. • Like DI, AOP supports loose coupling of application objects. • But with AOP, application-wide concerns (such as transactions and security) are decoupled from the objects to which they’re applied. rgupta.trainer@gmail.com
  • 8. DATA ACCESS DAO • Spring’s template-based JDBC abstraction can greatly simplify JDBC code • This module also builds a layer of meaningful exceptions on top of the error messages given by several database servers. • Spring provide hooks into several popular ORM frameworks, including Hibernate, Java Persistence API, Java Data Objects, and iBATIS SQL Maps. • Spring’s AOP module provide transaction management services for objects in a Spring application rgupta.trainer@gmail.com
  • 9. WEB AND REMOTING • Spring provide capable MVC framework that promotes Spring’s loosely coupled techniques in the web layer of an application • This framework comes in two forms: – a servlet-based framework • for conventional web applications and – portlet-based application • for developing against the Java portlet API. • Spring has remoting capabilities include Remote Method Invocation (RMI), JAX-WS rgupta.trainer@gmail.com
  • 10. What is Spring? Spring is a container and it manages the lifecycle and configuration of application object i.e. called Spring beans This make spring a container running within an container (ie JVM or web container) Spring is supposed to less complex framework then provided by framework such as EJB Thus bean is less complex EJB!!! rgupta.trainer@gmail.com
  • 11. Spring as an container… rgupta.trainer@gmail.com
  • 12. In a Spring application, objects are created, wired together, and live within the Spring container rgupta.trainer@gmail.com
  • 13. In a Spring application, objects are created, wired together, and live within the Spring container rgupta.trainer@gmail.com
  • 14. • In a Spring-based application, your application objects will live within the Spring container. • Container will create the objects, wire them together, configure them, and manage their complete lifecycle from cradle to grave (or new to finalize(), as the case may be). • The container is at the core of the Spring Framework. • Spring’s container uses dependency injection (DI) to manage the components that make up an application. • This includes creating associations between collaborating components. As such, these objects are cleaner and easier to understand, support reuse, and are easy to unit test rgupta.trainer@gmail.com
  • 15. Two important bean containers • org.springframework.beans.factory.BeanFactory • org.springframework.context.ApplicationContext rgupta.trainer@gmail.com
  • 16. Two type of container • Bean factories • defined by the org.springframework.beans.factory.BeanFactory interface) are the simplest of containers. • Bean factories provides basic support for DI. • Application contexts • defined by the org.springframework.context.ApplicationContext interface. • Application context build on the notion of a bean factory by providing application framework services, such as the ability to resolve textual messages from a properties file and the ability to publish application events to interested event listeners rgupta.trainer@gmail.com
  • 17. BeanFactory • Factory design pattern. BeanFactory factory =new XmlBeanFactory(new FileSystemResource(“e:/spring/beans.xml")); rgupta.trainer@gmail.com
  • 18. ApplicationContext An application context gives more: • Support for I18N(Internationalization) for messages. • Provides generic way to load resources. • Publish events to beans registered as events. rgupta.trainer@gmail.com
  • 19. ApplicationContext • ClassPathXmlApplicationContext - XML file located in the classpath • FileSystemXmlApplicationContext - XML file in the file system • XmlWebApplicationContext - XML file contained within a web application rgupta.trainer@gmail.com
  • 20. ApplicationContext • ApplicationContext context = new FileSystemXmlApplicationContext("c:/foo.xml"); • ApplicationContext context = new ClassPathXmlApplicationContext("foo.xml"); rgupta.trainer@gmail.com
  • 21. Beans Life cycle rgupta.trainer@gmail.com Above Figure is from Spring in action book, Manning publications
  • 22. ApplicationContext – Bean Life Cycle Above Figure is from Spring in action book, Manning rgupta.trainer@gmail.com publications