SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
Spring Framework




         Lic. Jorge Guerra Guerra
                Docente ISIL
          UNMSM OSUM Leader
The Spring Framework: Overview


Topics:
     What is Spring?
     Spring modules
     Why use Spring
     Dependency injection / IOC in detail
     Lab Work




                     Get to know Spring Framework
                                                    2
What is Spring?


The Spring Framework is an open source application
  framework for the Java platform and .NET Framework
  (Spring.NET)

It is based on code published in Expert One-on-One J2EE
    Design and Development by Rod Johnson (Wrox, 2002).



“   Spring is an open source framework created to address the complexity of
    enterprise application development. One of the chief advantages of the
    Spring framework is its layered architecture, which allows you to be selective
    about which of its components you use while also providing a cohesive
    framework for J2EE application development.

                         Get to know Spring Framework
                                                                                3
Evolución de Spring


 2002: Expert One-on-One J2EE Design and Development
 2003: Nace como proyecto Open Source
 2004: Spring 1.0
 2006: Spring 2.0
 2007: Spring 2.5
 2008: SpringSource
 2009: lo compra VMWare




                  Get to know OneNote
                                                       4
Principios de Spring


    Programación basada en POJOs
    Ligero
    Facilita las buenas prácticas de programación
    Modelo de programación consistente
    Facilita las pruebas
    No invasivo
    No reinventa la rueda




                 Get to know OneNote
                                                    5
How does the Spring Framework looks like?




             Get to know Spring Framework
                                            6
How does the Spring Framework looks like?


Each of the modules (or components) that comprise the Spring framework can stand on its own or
be implemented jointly with one or more of the others. The functionality of each component is as
follows:

The core container: The core container provides the essential functionality of the Spring
framework. A primary component of the core container is the BeanFactory, an implementation of
the Factory pattern. The BeanFactory applies the Inversion of Control (IOC) pattern to separate an
application's configuration and dependency specification from the actual application code.

Spring context: The Spring context is a configuration file that provides context information to the
Spring framework. The Spring context includes enterprise services such as JNDI, EJB, e-mail,
internalization, validation, and scheduling functionality.

Spring AOP: The Spring AOP module integrates aspect-oriented programming functionality directly
into the Spring framework, through its configuration management feature. As a result you can easily
AOP-enable any object managed by the Spring framework. The Spring AOP module provides
transaction management services for objects in any Spring-based application. With Spring AOP you
can incorporate declarative transaction management into your applications without relying on EJB
components.


                             Get to know Spring Framework
                                                                                                7
How does the Spring Framework looks like?


Spring DAO: The Spring JDBC DAO abstraction layer offers a meaningful exception
hierarchy for managing the exception handling and error messages thrown by different
database vendors. The exception hierarchy simplifies error handling and greatly reduces the
amount of exception code you need to write, such as opening and closing connections.
Spring DAO's JDBC-oriented exceptions comply to its generic DAO exception hierarchy.

Spring ORM: The Spring framework plugs into several ORM frameworks to provide its
Object Relational tool, including JDO, Hibernate, and iBatis SQL Maps. All of these comply to
Spring's generic transaction and DAO exception hierarchies.

Spring Web module: The Web context module builds on top of the application context
module, providing contexts for Web-based applications. As a result, the Spring framework
supports integration with Jakarta Struts. The Web module also eases the tasks of handling
multi-part requests and binding request parameters to domain objects.

Spring MVC framework: The MVC framework is a full-featured MVC implementation for
building Web applications. The MVC framework is highly configurable via strategy interfaces
and accommodates numerous view technologies including JSP, Velocity, Tiles, iText, and
POI.

                           Get to know Spring Framework
                                                                                        8
What does Spring Framework Offers: Summary


Inversion of Control container: configuration of application components and lifecycle management of Java
objects
Aspect-oriented programming: enables implementation of cross-cutting routines
Data access: working with relational database management systems on the Java platform using JDBC and
object-relational mapping tools
Transaction management: unifies several transaction management APIs and coordinates transactions for
Java objects
Model-view-controller: a HTTP and Servlet-based framework providing hooks for extension and
customization
Remote Access framework: configurative RPC-style export and import of Java objects over networks
supporting RMI, CORBA and HTTP-based protocols including web services (SOAP)
Convention-over-configuration: a rapid application development solution for Spring-based enterprise
applications is offered in the Spring Roo module
Batch processing: a framework for high-volume processing featuring reusable functions including
logging/tracing, transaction management, job processing statistics, job restart, skip, and resource management
Authentication and authorization: configurable security processes that support a range of standards,
protocols, tools and practices via the Spring Security sub-project (formerly Acegi).
Remote Management: configurative exposure and management of Java objects for local or remote
configuration via JMX
Messaging: configurative registration of message listener objects for transparent message consumption from
message queues via JMS, improvement of message sending over standard JMS APIs
Testing: support classes for writing unit tests and integration tests

                                Get to know Spring Framework
                                                                                                      9
Why use Spring?


Have you ever encountered these question?

•   Cant’ I have a simpler solution?

•   How can I handle my every changing requirements?

•   How can be the architecture flexible?

•   Can’t I have everything in components which can be verified independently?

•   Can I make a plug and play software?

•   How can the software components reusable and changeable?

•   Should we use EJB? As it makes the product complex, unpredictable and un-
    maintainable, non-portable and everything is framework committed.

•   …………….. And many more like these

                              SPRING IS THE ANSWER!

                          Get to know Spring Framework
                                                                                 10
Spring Framework’s Mission Statement


We believe that:
•      J2EE should be easier to use
•      It is best to program to interfaces, rather than classes. Spring reduces the
       complexity cost of using interfaces to zero.
•      JavaBeans offer a great way of configuring applications.
•      OO design is more important than any implementation technology, such as J2EE.
•      Checked exceptions are overused in Java. A platform shouldn't force you to catch
       exceptions you're unlikely to be able to recover from.
•      Testability is essential, and a platform such as Spring should help make your
       code easier to test.

We aim that:
•     Spring should be a pleasure to use
•     Your application code should not depend on Spring APIs
•     Spring should not compete with good existing solutions, but should foster
      integration. (For example, JDO, Toplink, and Hibernate are great O/R mapping
      solutions. We don't need to develop another one.)


                          Get to know Spring Framework
                                                                                      11
Are there any benefits of using spring?
Pure Java
            Founded on POJO-based development

        Ordinary Java classes that follow no special APIs
          Non-invasive for pre-existing POJOs
            Rewards framework-independent business logic
            Encourages new software to be written as POJOs
            Results in highly portable, reusable, and verifiable software


Less Custom Code
       Expand capabilities with less code
       Extensive and tested service abstractions
       Email, JMS, JMX, JSF, JDBC, etc…
       Replaces generic corporate libraries
       Mitigates custom integration activities
       Consistency eases integration because
       spring platform is easy to use

Turn-key solution
Spring components can be integrated quickly, with minimal effort and predictable results

                               Get to know Spring Framework
                                                                                           12
Are there any benefits of using spring?

 Helps only where needed
          Modularity allows only relevant components to be introduced into the application.
          For instance choose one:
                    Spring BeanFactory
                    Spring JMX
                    Spring JDBC
          Framework can be interfaced in deep or shallow layers.
          Interfaces are consistent at each layer


 Widely Available
          Spring is integrated into numerous frameworks
          Broad adoption possible because the container is portable and lightweight
                    The container itself is designed as a POJO
          Integration without third-party support
          Performance overhead is rarely a consideration as it is not EJB ;)


                            Get to know Spring Framework
                                                                                              13
What does Spring provide?


   Lightweight container and framework
     Most of your code will be unaware of the Spring framework
     Use only the parts you of Spring you want
   Manages dependencies between your objects
     Encourages use of interfaces
     Lessens “coupling” between objects
   Cleaner separation of responsibilities
     Put logic that applies to many objects in one single place
     Separate the class’s core responsibility from other duties
   Simplifies database integration
     Spring JDBC
     Hibernate
     iBATIS
     Java Persistence

                      Get to know OneNote
                                                                  14
Inversión de control


The IoC component of the Spring Framework addresses the enterprise
concern of taking the classes, objects, and services that are to compose
an application, by providing a formalized means of composing these
various disparate components into a fully working application ready for
use.


                                             Inyección de dependencias
                                             Ventajas
                                             Inyección por setter, por
                                             constructor, por método
                                             BeanFactory, ApplicationContext




                      Get to know Spring Framework
                                                                        15
The Core Spring Module: Defining Beans and Dependency Injection




Topics:
          Setting bean properties
          Supplying constructor arguments
          Using factory methods
          Dependency injection
                Supplying other beans as properties or constructor args




                       Get to know Spring Framework
                                                                          16
Spring Web Application




            Get to know OneNote
                                  17
Spring Hello World: What will we do?




•Code a plain Java class model.
– Use the interface pattern by coding a HelloWorld interface and a
   HelloWorldImpl implementation
• Configure the Spring IoC container.
• Instantiate the Spring IoC container.
• Acquire the object from the Spring IoC container.
– The client must only have knowledge of the interface, HelloWorld




                        Get to know Spring Framework
                                                                     18
Spring Hello World: Create POJO



  •   Create a interface HelloWorld
  •

  public interface HelloWorld {
                public void execute();
  }
  •    Create an implementing class HelloWorldImpl
  public class HelloWorldImpl
      implements HelloWorld {
                public void execute() {
                System.out.println("Hello World!");
                }
  }

                        Get to know Spring Framework
                                                       19
Spring Hello World: Spring IOC Configuration




<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

<bean id="helloWorld"
class="HelloWorldImpl" />


</beans>



                     Get to know Spring Framework
                                                                 20
Spring Hello World: Execute




import org.springframework.beans.factory.*;
import org.springframework.context.support.*;
public class Main{
public static void main(String[] args) {
BeanFactory beanFactory = new ClassPathXmlApplicationContext(
"applicationContext.xml");
HelloWorld helloWorld = (HelloWorld)
  beanFactory.getBean("helloWorld");
helloWorld.execute();
}

}

                        Get to know Spring Framework
                                                                21
Spring Hello World: Output




 Run the main class and you shall see “Hello World” printed.




                        Get to know Spring Framework
                                                               22
Spring Reference


       http://www.springsource.org/
       Top-level documentation page
         http://www.springframework.org/documentation
 • Wiki
      http://opensource.atlassian.com/confluence/spring
 • Forum
      http://forum.springframework.org
 • Books
      Spring Recipes. APress 2008
      Spring in Action. Manning 2007
      Agile Java Development with Spring, Hibernate and



                    Get to know Spring Framework
                                                          23

Contenu connexe

Tendances

Jetspeed-2 Overview
Jetspeed-2 OverviewJetspeed-2 Overview
Jetspeed-2 Overviewbettlebrox
 
Comparison of Java Web Application Frameworks
Comparison of Java Web Application FrameworksComparison of Java Web Application Frameworks
Comparison of Java Web Application FrameworksAngelin R
 
Building Commercial Applications with Oracle Applications Express by Scott Sp...
Building Commercial Applications with Oracle Applications Express by Scott Sp...Building Commercial Applications with Oracle Applications Express by Scott Sp...
Building Commercial Applications with Oracle Applications Express by Scott Sp...Enkitec
 
Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Aditya Jha
 
Comparison Of Open Source App Servers
Comparison Of Open Source App ServersComparison Of Open Source App Servers
Comparison Of Open Source App ServersRogue Wave Software
 
Summer training java
Summer training javaSummer training java
Summer training javaArshit Rai
 
Summer training java
Summer training javaSummer training java
Summer training javaArshit Rai
 
Laravel 9 is now out – how is an improvement over its predecessors
Laravel 9 is now out – how is an improvement over its predecessorsLaravel 9 is now out – how is an improvement over its predecessors
Laravel 9 is now out – how is an improvement over its predecessorsMoon Technolabs Pvt. Ltd.
 
Hennessey An Open Source Eye Gaze Interface Expanding The Adoption Of Eye Gaz...
Hennessey An Open Source Eye Gaze Interface Expanding The Adoption Of Eye Gaz...Hennessey An Open Source Eye Gaze Interface Expanding The Adoption Of Eye Gaz...
Hennessey An Open Source Eye Gaze Interface Expanding The Adoption Of Eye Gaz...Kalle
 
Why do developers prefer ionic to build progressive web apps
Why do developers prefer ionic to build progressive web apps  Why do developers prefer ionic to build progressive web apps
Why do developers prefer ionic to build progressive web apps Moon Technolabs Pvt. Ltd.
 
Java (Part 2) unit 1
Java (Part 2) unit 1Java (Part 2) unit 1
Java (Part 2) unit 1SURBHI SAROHA
 
Overview of Java
Overview of JavaOverview of Java
Overview of Javajosemachoco
 

Tendances (20)

Jetspeed-2 Overview
Jetspeed-2 OverviewJetspeed-2 Overview
Jetspeed-2 Overview
 
Comparison of Java Web Application Frameworks
Comparison of Java Web Application FrameworksComparison of Java Web Application Frameworks
Comparison of Java Web Application Frameworks
 
J2ee
J2eeJ2ee
J2ee
 
Building Commercial Applications with Oracle Applications Express by Scott Sp...
Building Commercial Applications with Oracle Applications Express by Scott Sp...Building Commercial Applications with Oracle Applications Express by Scott Sp...
Building Commercial Applications with Oracle Applications Express by Scott Sp...
 
Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...
 
Node.js vs. java
Node.js vs. javaNode.js vs. java
Node.js vs. java
 
Comparison Of Open Source App Servers
Comparison Of Open Source App ServersComparison Of Open Source App Servers
Comparison Of Open Source App Servers
 
Ch2
Ch2Ch2
Ch2
 
Summer training java
Summer training javaSummer training java
Summer training java
 
Summer training java
Summer training javaSummer training java
Summer training java
 
Introcution to EJB
Introcution to EJBIntrocution to EJB
Introcution to EJB
 
Laravel 9 is now out – how is an improvement over its predecessors
Laravel 9 is now out – how is an improvement over its predecessorsLaravel 9 is now out – how is an improvement over its predecessors
Laravel 9 is now out – how is an improvement over its predecessors
 
Ashok_Resume
Ashok_ResumeAshok_Resume
Ashok_Resume
 
Hennessey An Open Source Eye Gaze Interface Expanding The Adoption Of Eye Gaz...
Hennessey An Open Source Eye Gaze Interface Expanding The Adoption Of Eye Gaz...Hennessey An Open Source Eye Gaze Interface Expanding The Adoption Of Eye Gaz...
Hennessey An Open Source Eye Gaze Interface Expanding The Adoption Of Eye Gaz...
 
perl-java
perl-javaperl-java
perl-java
 
Mahesh_Dimble
Mahesh_DimbleMahesh_Dimble
Mahesh_Dimble
 
Why do developers prefer ionic to build progressive web apps
Why do developers prefer ionic to build progressive web apps  Why do developers prefer ionic to build progressive web apps
Why do developers prefer ionic to build progressive web apps
 
Java (Part 2) unit 1
Java (Part 2) unit 1Java (Part 2) unit 1
Java (Part 2) unit 1
 
Overview of Java
Overview of JavaOverview of Java
Overview of Java
 
SandeepVanama_Resume
SandeepVanama_ResumeSandeepVanama_Resume
SandeepVanama_Resume
 

En vedette

Spring presentecion isil
Spring presentecion isilSpring presentecion isil
Spring presentecion isilWilly Aguirre
 
Tecnólogo en gestión administrativa
Tecnólogo en gestión administrativaTecnólogo en gestión administrativa
Tecnólogo en gestión administrativaMapis Mora
 
Rust, el nuevo lenguaje de Mozilla
Rust, el nuevo lenguaje de MozillaRust, el nuevo lenguaje de Mozilla
Rust, el nuevo lenguaje de MozillaWilly Aguirre
 
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Rakesh Jha
 
jQuery Mobile with HTML5
jQuery Mobile with HTML5jQuery Mobile with HTML5
jQuery Mobile with HTML5madhurpgarg
 
jQuery Mobile: Progressive Enhancement with HTML5
jQuery Mobile: Progressive Enhancement with HTML5jQuery Mobile: Progressive Enhancement with HTML5
jQuery Mobile: Progressive Enhancement with HTML5Todd Anderson
 
Introduction to jQuery Mobile
Introduction to jQuery MobileIntroduction to jQuery Mobile
Introduction to jQuery Mobileejlp12
 

En vedette (10)

Spring presentecion isil
Spring presentecion isilSpring presentecion isil
Spring presentecion isil
 
Tecnólogo en gestión administrativa
Tecnólogo en gestión administrativaTecnólogo en gestión administrativa
Tecnólogo en gestión administrativa
 
Rust, el nuevo lenguaje de Mozilla
Rust, el nuevo lenguaje de MozillaRust, el nuevo lenguaje de Mozilla
Rust, el nuevo lenguaje de Mozilla
 
Jquerymobile ppt
Jquerymobile pptJquerymobile ppt
Jquerymobile ppt
 
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap
 
jQuery Mobile with HTML5
jQuery Mobile with HTML5jQuery Mobile with HTML5
jQuery Mobile with HTML5
 
jQuery Mobile: Progressive Enhancement with HTML5
jQuery Mobile: Progressive Enhancement with HTML5jQuery Mobile: Progressive Enhancement with HTML5
jQuery Mobile: Progressive Enhancement with HTML5
 
Presentation R
Presentation RPresentation R
Presentation R
 
Introduction to jQuery Mobile
Introduction to jQuery MobileIntroduction to jQuery Mobile
Introduction to jQuery Mobile
 
jQuery Mobile
jQuery MobilejQuery Mobile
jQuery Mobile
 

Similaire à Spring presentecion isil

Spring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggetsSpring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggetsVirtual Nuggets
 
The Complete Spring Tutorial
The Complete Spring TutorialThe Complete Spring Tutorial
The Complete Spring Tutorialcribes
 
Spring Book – Chapter 1 – Introduction
Spring Book – Chapter 1 – IntroductionSpring Book – Chapter 1 – Introduction
Spring Book – Chapter 1 – IntroductionTomcy John
 
Spring basics for freshers
Spring basics for freshersSpring basics for freshers
Spring basics for freshersSwati Bansal
 
Spring boot vs spring framework razor sharp web applications
Spring boot vs spring framework razor sharp web applicationsSpring boot vs spring framework razor sharp web applications
Spring boot vs spring framework razor sharp web applicationsKaty Slemon
 
How Spring Framework Really Works?
How Spring Framework Really Works?How Spring Framework Really Works?
How Spring Framework Really Works?NexSoftsys
 
Spring framework Introduction
Spring framework  IntroductionSpring framework  Introduction
Spring framework IntroductionAnuj Singh Rajput
 
Spring framework
Spring frameworkSpring framework
Spring frameworkKani Selvam
 
List of 7 popular java frameworks for 2019
List of 7 popular java frameworks for 2019  List of 7 popular java frameworks for 2019
List of 7 popular java frameworks for 2019 kritikumar16
 
List of 7 popular java frameworks for 2019
List of 7 popular java frameworks for 2019  List of 7 popular java frameworks for 2019
List of 7 popular java frameworks for 2019 kritikumar16
 
TheSpringFramework
TheSpringFrameworkTheSpringFramework
TheSpringFrameworkShankar Nair
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworksMukesh Kumar
 

Similaire à Spring presentecion isil (20)

Spring Framework Rohit
Spring Framework RohitSpring Framework Rohit
Spring Framework Rohit
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Spring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggetsSpring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggets
 
The Complete Spring Tutorial
The Complete Spring TutorialThe Complete Spring Tutorial
The Complete Spring Tutorial
 
Spring Book – Chapter 1 – Introduction
Spring Book – Chapter 1 – IntroductionSpring Book – Chapter 1 – Introduction
Spring Book – Chapter 1 – Introduction
 
Spring basics for freshers
Spring basics for freshersSpring basics for freshers
Spring basics for freshers
 
Spring notes
Spring notesSpring notes
Spring notes
 
Spring boot vs spring framework razor sharp web applications
Spring boot vs spring framework razor sharp web applicationsSpring boot vs spring framework razor sharp web applications
Spring boot vs spring framework razor sharp web applications
 
How Spring Framework Really Works?
How Spring Framework Really Works?How Spring Framework Really Works?
How Spring Framework Really Works?
 
Spring
SpringSpring
Spring
 
Spring framework Introduction
Spring framework  IntroductionSpring framework  Introduction
Spring framework Introduction
 
spring
springspring
spring
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
List of 7 popular java frameworks for 2019
List of 7 popular java frameworks for 2019  List of 7 popular java frameworks for 2019
List of 7 popular java frameworks for 2019
 
List of 7 popular java frameworks for 2019
List of 7 popular java frameworks for 2019  List of 7 popular java frameworks for 2019
List of 7 popular java frameworks for 2019
 
Introduction to Spring & Spring BootFramework
Introduction to Spring  & Spring BootFrameworkIntroduction to Spring  & Spring BootFramework
Introduction to Spring & Spring BootFramework
 
TheSpringFramework
TheSpringFrameworkTheSpringFramework
TheSpringFramework
 
Spring
SpringSpring
Spring
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
 

Plus de Willy Aguirre

Plus de Willy Aguirre (11)

Marketplace slide
Marketplace slideMarketplace slide
Marketplace slide
 
Juegos html5
Juegos html5Juegos html5
Juegos html5
 
Encuesta final final
Encuesta final finalEncuesta final final
Encuesta final final
 
Encuesta final
Encuesta finalEncuesta final
Encuesta final
 
Resultado de la encuesta "La Gastronomía Peruana
Resultado de la encuesta "La Gastronomía PeruanaResultado de la encuesta "La Gastronomía Peruana
Resultado de la encuesta "La Gastronomía Peruana
 
Clase 2
Clase 2 Clase 2
Clase 2
 
Clase 1
Clase 1 Clase 1
Clase 1
 
Examenes certificacion
Examenes certificacionExamenes certificacion
Examenes certificacion
 
como registrase en SAI
como registrase en SAIcomo registrase en SAI
como registrase en SAI
 
Sai peru loginguide
Sai peru loginguideSai peru loginguide
Sai peru loginguide
 
Diseño de Interfaces
Diseño de InterfacesDiseño de Interfaces
Diseño de Interfaces
 

Dernier

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 

Dernier (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 

Spring presentecion isil

  • 1. Spring Framework Lic. Jorge Guerra Guerra Docente ISIL UNMSM OSUM Leader
  • 2. The Spring Framework: Overview Topics: What is Spring? Spring modules Why use Spring Dependency injection / IOC in detail Lab Work Get to know Spring Framework 2
  • 3. What is Spring? The Spring Framework is an open source application framework for the Java platform and .NET Framework (Spring.NET) It is based on code published in Expert One-on-One J2EE Design and Development by Rod Johnson (Wrox, 2002). “ Spring is an open source framework created to address the complexity of enterprise application development. One of the chief advantages of the Spring framework is its layered architecture, which allows you to be selective about which of its components you use while also providing a cohesive framework for J2EE application development. Get to know Spring Framework 3
  • 4. Evolución de Spring 2002: Expert One-on-One J2EE Design and Development 2003: Nace como proyecto Open Source 2004: Spring 1.0 2006: Spring 2.0 2007: Spring 2.5 2008: SpringSource 2009: lo compra VMWare Get to know OneNote 4
  • 5. Principios de Spring Programación basada en POJOs Ligero Facilita las buenas prácticas de programación Modelo de programación consistente Facilita las pruebas No invasivo No reinventa la rueda Get to know OneNote 5
  • 6. How does the Spring Framework looks like? Get to know Spring Framework 6
  • 7. How does the Spring Framework looks like? Each of the modules (or components) that comprise the Spring framework can stand on its own or be implemented jointly with one or more of the others. The functionality of each component is as follows: The core container: The core container provides the essential functionality of the Spring framework. A primary component of the core container is the BeanFactory, an implementation of the Factory pattern. The BeanFactory applies the Inversion of Control (IOC) pattern to separate an application's configuration and dependency specification from the actual application code. Spring context: The Spring context is a configuration file that provides context information to the Spring framework. The Spring context includes enterprise services such as JNDI, EJB, e-mail, internalization, validation, and scheduling functionality. Spring AOP: The Spring AOP module integrates aspect-oriented programming functionality directly into the Spring framework, through its configuration management feature. As a result you can easily AOP-enable any object managed by the Spring framework. The Spring AOP module provides transaction management services for objects in any Spring-based application. With Spring AOP you can incorporate declarative transaction management into your applications without relying on EJB components. Get to know Spring Framework 7
  • 8. How does the Spring Framework looks like? Spring DAO: The Spring JDBC DAO abstraction layer offers a meaningful exception hierarchy for managing the exception handling and error messages thrown by different database vendors. The exception hierarchy simplifies error handling and greatly reduces the amount of exception code you need to write, such as opening and closing connections. Spring DAO's JDBC-oriented exceptions comply to its generic DAO exception hierarchy. Spring ORM: The Spring framework plugs into several ORM frameworks to provide its Object Relational tool, including JDO, Hibernate, and iBatis SQL Maps. All of these comply to Spring's generic transaction and DAO exception hierarchies. Spring Web module: The Web context module builds on top of the application context module, providing contexts for Web-based applications. As a result, the Spring framework supports integration with Jakarta Struts. The Web module also eases the tasks of handling multi-part requests and binding request parameters to domain objects. Spring MVC framework: The MVC framework is a full-featured MVC implementation for building Web applications. The MVC framework is highly configurable via strategy interfaces and accommodates numerous view technologies including JSP, Velocity, Tiles, iText, and POI. Get to know Spring Framework 8
  • 9. What does Spring Framework Offers: Summary Inversion of Control container: configuration of application components and lifecycle management of Java objects Aspect-oriented programming: enables implementation of cross-cutting routines Data access: working with relational database management systems on the Java platform using JDBC and object-relational mapping tools Transaction management: unifies several transaction management APIs and coordinates transactions for Java objects Model-view-controller: a HTTP and Servlet-based framework providing hooks for extension and customization Remote Access framework: configurative RPC-style export and import of Java objects over networks supporting RMI, CORBA and HTTP-based protocols including web services (SOAP) Convention-over-configuration: a rapid application development solution for Spring-based enterprise applications is offered in the Spring Roo module Batch processing: a framework for high-volume processing featuring reusable functions including logging/tracing, transaction management, job processing statistics, job restart, skip, and resource management Authentication and authorization: configurable security processes that support a range of standards, protocols, tools and practices via the Spring Security sub-project (formerly Acegi). Remote Management: configurative exposure and management of Java objects for local or remote configuration via JMX Messaging: configurative registration of message listener objects for transparent message consumption from message queues via JMS, improvement of message sending over standard JMS APIs Testing: support classes for writing unit tests and integration tests Get to know Spring Framework 9
  • 10. Why use Spring? Have you ever encountered these question? • Cant’ I have a simpler solution? • How can I handle my every changing requirements? • How can be the architecture flexible? • Can’t I have everything in components which can be verified independently? • Can I make a plug and play software? • How can the software components reusable and changeable? • Should we use EJB? As it makes the product complex, unpredictable and un- maintainable, non-portable and everything is framework committed. • …………….. And many more like these SPRING IS THE ANSWER! Get to know Spring Framework 10
  • 11. Spring Framework’s Mission Statement We believe that: • J2EE should be easier to use • It is best to program to interfaces, rather than classes. Spring reduces the complexity cost of using interfaces to zero. • JavaBeans offer a great way of configuring applications. • OO design is more important than any implementation technology, such as J2EE. • Checked exceptions are overused in Java. A platform shouldn't force you to catch exceptions you're unlikely to be able to recover from. • Testability is essential, and a platform such as Spring should help make your code easier to test. We aim that: • Spring should be a pleasure to use • Your application code should not depend on Spring APIs • Spring should not compete with good existing solutions, but should foster integration. (For example, JDO, Toplink, and Hibernate are great O/R mapping solutions. We don't need to develop another one.) Get to know Spring Framework 11
  • 12. Are there any benefits of using spring? Pure Java Founded on POJO-based development Ordinary Java classes that follow no special APIs Non-invasive for pre-existing POJOs Rewards framework-independent business logic Encourages new software to be written as POJOs Results in highly portable, reusable, and verifiable software Less Custom Code Expand capabilities with less code Extensive and tested service abstractions Email, JMS, JMX, JSF, JDBC, etc… Replaces generic corporate libraries Mitigates custom integration activities Consistency eases integration because spring platform is easy to use Turn-key solution Spring components can be integrated quickly, with minimal effort and predictable results Get to know Spring Framework 12
  • 13. Are there any benefits of using spring? Helps only where needed Modularity allows only relevant components to be introduced into the application. For instance choose one: Spring BeanFactory Spring JMX Spring JDBC Framework can be interfaced in deep or shallow layers. Interfaces are consistent at each layer Widely Available Spring is integrated into numerous frameworks Broad adoption possible because the container is portable and lightweight The container itself is designed as a POJO Integration without third-party support Performance overhead is rarely a consideration as it is not EJB ;) Get to know Spring Framework 13
  • 14. What does Spring provide? Lightweight container and framework Most of your code will be unaware of the Spring framework Use only the parts you of Spring you want Manages dependencies between your objects Encourages use of interfaces Lessens “coupling” between objects Cleaner separation of responsibilities Put logic that applies to many objects in one single place Separate the class’s core responsibility from other duties Simplifies database integration Spring JDBC Hibernate iBATIS Java Persistence Get to know OneNote 14
  • 15. Inversión de control The IoC component of the Spring Framework addresses the enterprise concern of taking the classes, objects, and services that are to compose an application, by providing a formalized means of composing these various disparate components into a fully working application ready for use. Inyección de dependencias Ventajas Inyección por setter, por constructor, por método BeanFactory, ApplicationContext Get to know Spring Framework 15
  • 16. The Core Spring Module: Defining Beans and Dependency Injection Topics: Setting bean properties Supplying constructor arguments Using factory methods Dependency injection Supplying other beans as properties or constructor args Get to know Spring Framework 16
  • 17. Spring Web Application Get to know OneNote 17
  • 18. Spring Hello World: What will we do? •Code a plain Java class model. – Use the interface pattern by coding a HelloWorld interface and a HelloWorldImpl implementation • Configure the Spring IoC container. • Instantiate the Spring IoC container. • Acquire the object from the Spring IoC container. – The client must only have knowledge of the interface, HelloWorld Get to know Spring Framework 18
  • 19. Spring Hello World: Create POJO • Create a interface HelloWorld • public interface HelloWorld { public void execute(); } • Create an implementing class HelloWorldImpl public class HelloWorldImpl implements HelloWorld { public void execute() { System.out.println("Hello World!"); } } Get to know Spring Framework 19
  • 20. Spring Hello World: Spring IOC Configuration <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean id="helloWorld" class="HelloWorldImpl" /> </beans> Get to know Spring Framework 20
  • 21. Spring Hello World: Execute import org.springframework.beans.factory.*; import org.springframework.context.support.*; public class Main{ public static void main(String[] args) { BeanFactory beanFactory = new ClassPathXmlApplicationContext( "applicationContext.xml"); HelloWorld helloWorld = (HelloWorld) beanFactory.getBean("helloWorld"); helloWorld.execute(); } } Get to know Spring Framework 21
  • 22. Spring Hello World: Output Run the main class and you shall see “Hello World” printed. Get to know Spring Framework 22
  • 23. Spring Reference http://www.springsource.org/ Top-level documentation page http://www.springframework.org/documentation • Wiki http://opensource.atlassian.com/confluence/spring • Forum http://forum.springframework.org • Books Spring Recipes. APress 2008 Spring in Action. Manning 2007 Agile Java Development with Spring, Hibernate and Get to know Spring Framework 23