SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Spring Framework
Vibrant Technology & Computers 1
Vibrant
Technology
&
Computers
Vibrant Technology & Computers 2
Spring Overview
• Spring is an open source layered Java/J2EE application
framework
• Created by Rod Johnson
• Based on book “Expert one-on-one J2EE Design and
Development” (October, 2002)
• Current version 2.0.6 (released on 2007-06-18)
• The Spring Framework is licensed under the terms of the
Apache License, Version 2.0 and can be downloaded at:
• http://www.springframework.org/download
• Philosophy: J2EE should be easier to use,
“Lightweight Container” concept
A software framework is a re-usable
design for a software system.
Vibrant Technology & Computers 3
What are Lightweight Frameworks?
• Non-intrusive
• No container requirements
• Simplify application development
• Remove re-occurring pattern code
• Productivity friendly
• Unit test friendly
• Very pluggable
• Usually open source
• Examples:
• Spring, Pico, Hivemind
• Hibernate, IBatis, Castor
• WebWork
• Quartz
• Sitemesh
Vibrant Technology & Computers 4
Spring Mission Statement
• J2EE should be easier to use
• It's 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 framework shouldn't
force you to catch exceptions you're unlikely to be able to recover
from.
• Testability is essential, and a framework such as Spring should help
make your code easier to test
• 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 and Hibernate are great O/R
mapping solutions. Don't need to develop another one).
Vibrant Technology & Computers 5
Modules of the Spring Framework
The Spring Framework can be considered as a collection
of frameworks-in-the-framework:
• Core - Inversion of Control (IoC) and Dependency Injection
• AOP - Aspect-oriented programming
• DAO - Data Access Object support, transaction management,
JDBC-abstraction
• ORM - Object Relational Mapping data access, integration
layers for JPA, JDO, Hibernate, and iBatis
• MVC - Model-View-Controller implementation for web-
applications
• Remote Access, Authentication and Authorization, Remote
Management, Messaging Framework, Web Services, Email,
Testing, …
Vibrant Technology & Computers 6
Overview of the Spring Framework
Very loosely coupled, components widely reusable and
separately packaged.
Vibrant Technology & Computers 7
Spring Details
• Spring allows to decouple software layers by injecting a component’s
dependencies at runtime rather than having them declared at compile time via
importing and instantiating classes.
• Spring provides integration for J2EE services such as EJB, JDBC, JNDI,
JMS, JTA. It also integrates several popular ORM toolkits such as Hibernate
and JDO and assorted other services as well.
• One of the highly touted features is declarative transactions, which allows the
developer to write transaction-unaware code and configure transactions in
Spring config files.
• Spring is built on the principle of unchecked exception handling. This also
reduces code dependencies between layers. Spring provides a granular
exception hierarchy for data access operations and maps JDBC, EJB, and
ORM exceptions to Spring exceptions so that applications can get better
information about the error condition.
• With highly decoupled software layers and programming to interfaces, each
layer is easier to test. Mock objects is a testing pattern that is very useful in
this regard.
Vibrant Technology & Computers 8
Advantages of Spring Architecture
• 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, proliferation of pointless classes
(locators/delegates); Spring eliminates them
• Cross-cutting behavior (resource management is cross-cutting
concern, easy to copy-and-paste everywhere)
• Portable (can use server-side in web/ejb app, client-side in swing app,
business logic is completely portable)
Vibrant Technology & Computers 9
Spring Solutions
• Solutions address major J2EE problem areas:
• Web application development (MVC)
• Enterprise Java Beans (EJB, JNDI)
• Database access (JDBC, iBatis, ORM)
• Transaction management (JTA, Hibernate, JDBC)
• Remote access (Web Services, RMI)
• Each solution builds on the core architecture
• Solutions foster integration, they do not re-invent
the wheel
Vibrant Technology & Computers 10
How to Start Using Spring
• Download Spring from www.springframework.org, e.g.
spring-framework-2.0.6-with-dependencies.zip
• Unzip to some location, e.g.
C:toolsspring-framework-2.0.6
• Folder C:toolsspring-framework-2.0.6dist
contains Spring distribution jar files
• Add libraries to your application classpath
and start programming with Spring
Vibrant Technology & Computers 11
Inversion of Control (IoC)
• Central in the Spring is its Inversion of Control container
• Based on “Inversion of Control Containers and the
Dependency Injection pattern” (Martin Fowler)
• Provides centralized, automated configuration, managing and
wiring of application Java objects
• Container responsibilities:
• creating objects,
• configuring objects,
• calling initialization methods
• passing objects to registered callback objects
• etc
• All together form the object lifecycle which is one of the most
important features
Java objects that are managed
by the Spring IoC container are
referred to as beans
Vibrant Technology & Computers 12
Dependency Injection – Non-IoC
public class MainBookmarkProcessor implements BookmarkProcessor{
private PageDownloader pageDownloader;
private RssParser rssParser;
public List<Bookmark> loadBookmarks()
{
// direct initialization
pageDownloader = new ApachePageDownloader();
rssParser = new JenaRssParser();
// or factory initialization
// pageDownloader = PageDownloaderFactory.getPageDownloader();
// rssParser = RssParserFactory.getRssParser();
// use initialized objects
pageDownloader.downloadPage(url);
rssParser.extractBookmarks(fileName, resourceName);
// ...
}
Vibrant Technology & Computers 13
Dependency Injection - IoC
• Beans define their dependencies through constructor arguments or
properties
• Container resolves (injects) dependencies of components by setting
implementation object during runtime
• BeanFactory interface - the core that
loads bean definitions and manages beans
• Most commonly used implementation
is the XmlBeanFactory class
• Allows 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
Vibrant Technology & Computers 14
Non-IoC versus IoC
Non Inversion of Control
approach
Inversion of Control
approach
Vibrant Technology & Computers 15
IoC Basics
• Basic JavaBean pattern:
• include a “getter” and “setter” method for each field:
• Rather than locating needed resources, application components
provide setters through which resources are passed in during
initialization
• In Spring Framework, this pattern is used extensively, and
initialization is usually done through configuration file rather than
application code
class MyBean {
private int counter;
public int getCounter()
{ return counter; }
public void setCounter(int counter)
{ this.counter = counter; }
}
Vibrant Technology & Computers 16
IoC Java Bean
public class MainBookmarkProcessor implements BookmarkProcessor{
private PageDownloader pageDownloader;
private RssParser rssParser;
public List<Bookmark> loadBookmarks()
{
pageDownloader.downloadPage(url);
rssParser.extractBookmarks(fileName, resourceName);
// ...
}
public void setPageDownloader(PageDownloader pageDownloader){
this.pageDownloader = pageDownloader;
}
public void setRssParser(RssParser rssParser){
this.rssParser = rssParser;
}
Vibrant Technology & Computers 17
References
• Spring Home:
http://www.springframework.org
• Inversion of Control Containers and the Dependency
Injection pattern
http://www.martinfowler.com/articles/injection.html
• Spring IoC Container:
http://static.springframework.org/spring/docs/2.0.x/referenc
e/beans.html
• Introduction to the Spring Framework by Rod Johnson
http://www.theserverside.com/tt/articles/article.tss?
l=SpringFramework
Vibrant Technology & Computers 18
Thank you…
Vibrant Technology & Computers 19

Weitere ähnliche Inhalte

Was ist angesagt?

Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to strutsAnup72
 
Java Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewJava Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewEugene Bogaart
 
Liferay architecture By Navin Agarwal
Liferay architecture By Navin AgarwalLiferay architecture By Navin Agarwal
Liferay architecture By Navin AgarwalNavin Agarwal
 
Portlet Framework: the Liferay way
Portlet Framework: the Liferay wayPortlet Framework: the Liferay way
Portlet Framework: the Liferay wayriround
 
Introduction to Portlets Using Liferay Portal
Introduction to Portlets Using Liferay PortalIntroduction to Portlets Using Liferay Portal
Introduction to Portlets Using Liferay Portalrivetlogic
 
OOW 2009 Using FMW EBS R12
OOW 2009 Using FMW EBS R12OOW 2009 Using FMW EBS R12
OOW 2009 Using FMW EBS R12jucaab
 
JEE Course - JEE Overview
JEE Course - JEE  OverviewJEE Course - JEE  Overview
JEE Course - JEE Overviewodedns
 
The Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologyThe Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologySimon Ritter
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6Bert Ertman
 
Developing Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java TechnologyDeveloping Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java TechnologySimon Ritter
 
The Top 10 Things Oracle UCM Users Need To Know About WebLogic
The Top 10 Things Oracle UCM Users Need To Know About WebLogicThe Top 10 Things Oracle UCM Users Need To Know About WebLogic
The Top 10 Things Oracle UCM Users Need To Know About WebLogicBrian Huff
 
Building 12-factor Cloud Native Microservices
Building 12-factor Cloud Native MicroservicesBuilding 12-factor Cloud Native Microservices
Building 12-factor Cloud Native MicroservicesJakarta_EE
 
Workshop OSGI PPT
Workshop OSGI PPTWorkshop OSGI PPT
Workshop OSGI PPTSummer Lu
 
Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013Edward Burns
 
Migrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFXMigrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFXBruno Borges
 

Was ist angesagt? (19)

Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to struts
 
Java Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewJava Enterprise Edition 6 Overview
Java Enterprise Edition 6 Overview
 
Liferay architecture By Navin Agarwal
Liferay architecture By Navin AgarwalLiferay architecture By Navin Agarwal
Liferay architecture By Navin Agarwal
 
Portlet Framework: the Liferay way
Portlet Framework: the Liferay wayPortlet Framework: the Liferay way
Portlet Framework: the Liferay way
 
Introduction to Portlets Using Liferay Portal
Introduction to Portlets Using Liferay PortalIntroduction to Portlets Using Liferay Portal
Introduction to Portlets Using Liferay Portal
 
Liferay and Cloud
Liferay and CloudLiferay and Cloud
Liferay and Cloud
 
OOW 2009 Using FMW EBS R12
OOW 2009 Using FMW EBS R12OOW 2009 Using FMW EBS R12
OOW 2009 Using FMW EBS R12
 
Java Spring
Java SpringJava Spring
Java Spring
 
JEE Course - JEE Overview
JEE Course - JEE  OverviewJEE Course - JEE  Overview
JEE Course - JEE Overview
 
The Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologyThe Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans Technology
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6
 
Developing Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java TechnologyDeveloping Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java Technology
 
The Top 10 Things Oracle UCM Users Need To Know About WebLogic
The Top 10 Things Oracle UCM Users Need To Know About WebLogicThe Top 10 Things Oracle UCM Users Need To Know About WebLogic
The Top 10 Things Oracle UCM Users Need To Know About WebLogic
 
Building 12-factor Cloud Native Microservices
Building 12-factor Cloud Native MicroservicesBuilding 12-factor Cloud Native Microservices
Building 12-factor Cloud Native Microservices
 
Workshop OSGI PPT
Workshop OSGI PPTWorkshop OSGI PPT
Workshop OSGI PPT
 
Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Migrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFXMigrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFX
 
Java on Azure
Java on AzureJava on Azure
Java on Azure
 

Andere mochten auch

1213454 한자연 디자인과 문화 보고서
1213454 한자연 디자인과 문화 보고서1213454 한자연 디자인과 문화 보고서
1213454 한자연 디자인과 문화 보고서자연 한
 
숙명여자대학교 디자인과 문화 보고서 1213454 한자연
숙명여자대학교 디자인과 문화 보고서 1213454 한자연숙명여자대학교 디자인과 문화 보고서 1213454 한자연
숙명여자대학교 디자인과 문화 보고서 1213454 한자연자연 한
 
[명우니닷컴]DB-휘트니스센터-데이터모델링
[명우니닷컴]DB-휘트니스센터-데이터모델링[명우니닷컴]DB-휘트니스센터-데이터모델링
[명우니닷컴]DB-휘트니스센터-데이터모델링Myeongun Ryu
 
Effective Persistence Using ORM With Hibernate
Effective Persistence Using ORM With HibernateEffective Persistence Using ORM With Hibernate
Effective Persistence Using ORM With HibernateEdureka!
 
컬러배스 4444
컬러배스 4444컬러배스 4444
컬러배스 4444Moondajung
 
실리콘밸리의 한국인 2015 - 권기태 발표
실리콘밸리의 한국인 2015 - 권기태 발표실리콘밸리의 한국인 2015 - 권기태 발표
실리콘밸리의 한국인 2015 - 권기태 발표StartupAlliance
 
TheSpringFramework
TheSpringFrameworkTheSpringFramework
TheSpringFrameworkShankar Nair
 
Leverage Hibernate and Spring Features Together
Leverage Hibernate and Spring Features TogetherLeverage Hibernate and Spring Features Together
Leverage Hibernate and Spring Features TogetherEdureka!
 
협동조합역할극워크숍
협동조합역할극워크숍협동조합역할극워크숍
협동조합역할극워크숍수원 주
 
Skillwise-Spring framework 1
Skillwise-Spring framework 1Skillwise-Spring framework 1
Skillwise-Spring framework 1Skillwise Group
 
Spring overview &amp; architecture
Spring  overview &amp; architectureSpring  overview &amp; architecture
Spring overview &amp; architecturesaurabhshcs
 
Building Web Application Using Spring Framework
Building Web Application Using Spring FrameworkBuilding Web Application Using Spring Framework
Building Web Application Using Spring FrameworkEdureka!
 
Go lang(goroutine, channel, 동기화 객체)
Go lang(goroutine, channel, 동기화 객체)Go lang(goroutine, channel, 동기화 객체)
Go lang(goroutine, channel, 동기화 객체)seungkyu park
 
Link prediction 방법의 개념 및 활용
Link prediction 방법의 개념 및 활용Link prediction 방법의 개념 및 활용
Link prediction 방법의 개념 및 활용Kyunghoon Kim
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework Serhat Can
 
Spring framework
Spring frameworkSpring framework
Spring frameworkAircon Chen
 
Getting Started with Spring Framework
Getting Started with Spring FrameworkGetting Started with Spring Framework
Getting Started with Spring FrameworkEdureka!
 
[코딩카페]웹접근성 이해하기 유정식
[코딩카페]웹접근성 이해하기 유정식[코딩카페]웹접근성 이해하기 유정식
[코딩카페]웹접근성 이해하기 유정식jeong-sic Yoo
 

Andere mochten auch (20)

1213454 한자연 디자인과 문화 보고서
1213454 한자연 디자인과 문화 보고서1213454 한자연 디자인과 문화 보고서
1213454 한자연 디자인과 문화 보고서
 
숙명여자대학교 디자인과 문화 보고서 1213454 한자연
숙명여자대학교 디자인과 문화 보고서 1213454 한자연숙명여자대학교 디자인과 문화 보고서 1213454 한자연
숙명여자대학교 디자인과 문화 보고서 1213454 한자연
 
Spring framework v2
Spring framework v2Spring framework v2
Spring framework v2
 
[명우니닷컴]DB-휘트니스센터-데이터모델링
[명우니닷컴]DB-휘트니스센터-데이터모델링[명우니닷컴]DB-휘트니스센터-데이터모델링
[명우니닷컴]DB-휘트니스센터-데이터모델링
 
Effective Persistence Using ORM With Hibernate
Effective Persistence Using ORM With HibernateEffective Persistence Using ORM With Hibernate
Effective Persistence Using ORM With Hibernate
 
컬러배스 4444
컬러배스 4444컬러배스 4444
컬러배스 4444
 
실리콘밸리의 한국인 2015 - 권기태 발표
실리콘밸리의 한국인 2015 - 권기태 발표실리콘밸리의 한국인 2015 - 권기태 발표
실리콘밸리의 한국인 2015 - 권기태 발표
 
TheSpringFramework
TheSpringFrameworkTheSpringFramework
TheSpringFramework
 
Leverage Hibernate and Spring Features Together
Leverage Hibernate and Spring Features TogetherLeverage Hibernate and Spring Features Together
Leverage Hibernate and Spring Features Together
 
협동조합역할극워크숍
협동조합역할극워크숍협동조합역할극워크숍
협동조합역할극워크숍
 
Skillwise-Spring framework 1
Skillwise-Spring framework 1Skillwise-Spring framework 1
Skillwise-Spring framework 1
 
Spring overview &amp; architecture
Spring  overview &amp; architectureSpring  overview &amp; architecture
Spring overview &amp; architecture
 
Building Web Application Using Spring Framework
Building Web Application Using Spring FrameworkBuilding Web Application Using Spring Framework
Building Web Application Using Spring Framework
 
Go lang(goroutine, channel, 동기화 객체)
Go lang(goroutine, channel, 동기화 객체)Go lang(goroutine, channel, 동기화 객체)
Go lang(goroutine, channel, 동기화 객체)
 
Smart work
Smart workSmart work
Smart work
 
Link prediction 방법의 개념 및 활용
Link prediction 방법의 개념 및 활용Link prediction 방법의 개념 및 활용
Link prediction 방법의 개념 및 활용
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Getting Started with Spring Framework
Getting Started with Spring FrameworkGetting Started with Spring Framework
Getting Started with Spring Framework
 
[코딩카페]웹접근성 이해하기 유정식
[코딩카페]웹접근성 이해하기 유정식[코딩카페]웹접근성 이해하기 유정식
[코딩카페]웹접근성 이해하기 유정식
 

Ähnlich wie Spring intro classes-in-mumbai

Spring introduction
Spring introductionSpring introduction
Spring introductionManav Prasad
 
Framework adoption for java enterprise application development
Framework adoption for java enterprise application developmentFramework adoption for java enterprise application development
Framework adoption for java enterprise application developmentClarence Ho
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworksMukesh Kumar
 
스프링 프레임워크
스프링 프레임워크스프링 프레임워크
스프링 프레임워크Yoonki Chang
 
Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to SpringSujit Kumar
 
The Power of Enterprise Java Frameworks
The Power of Enterprise Java FrameworksThe Power of Enterprise Java Frameworks
The Power of Enterprise Java FrameworksClarence Ho
 
Chapter 10:Understanding Java Related Platforms and Integration Technologies
Chapter 10:Understanding Java Related Platforms and Integration TechnologiesChapter 10:Understanding Java Related Platforms and Integration Technologies
Chapter 10:Understanding Java Related Platforms and Integration TechnologiesIt Academy
 
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud EnvironmentsTools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud EnvironmentsVMware Tanzu
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC frameworkMohit Gupta
 
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
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkASG
 
How Spring Framework Really Works?
How Spring Framework Really Works?How Spring Framework Really Works?
How Spring Framework Really Works?NexSoftsys
 
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
 
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»DataArt
 

Ähnlich wie Spring intro classes-in-mumbai (20)

Spring introduction
Spring introductionSpring introduction
Spring introduction
 
Framework adoption for java enterprise application development
Framework adoption for java enterprise application developmentFramework adoption for java enterprise application development
Framework adoption for java enterprise application development
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
 
spring
springspring
spring
 
스프링 프레임워크
스프링 프레임워크스프링 프레임워크
스프링 프레임워크
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Oracle Data Integrator
Oracle Data Integrator Oracle Data Integrator
Oracle Data Integrator
 
Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to Spring
 
Spring Framework Rohit
Spring Framework RohitSpring Framework Rohit
Spring Framework Rohit
 
The Power of Enterprise Java Frameworks
The Power of Enterprise Java FrameworksThe Power of Enterprise Java Frameworks
The Power of Enterprise Java Frameworks
 
Introduction to Spring & Spring BootFramework
Introduction to Spring  & Spring BootFrameworkIntroduction to Spring  & Spring BootFramework
Introduction to Spring & Spring BootFramework
 
Chapter 10:Understanding Java Related Platforms and Integration Technologies
Chapter 10:Understanding Java Related Platforms and Integration TechnologiesChapter 10:Understanding Java Related Platforms and Integration Technologies
Chapter 10:Understanding Java Related Platforms and Integration Technologies
 
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud EnvironmentsTools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC framework
 
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
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Spring notes
Spring notesSpring notes
Spring notes
 
How Spring Framework Really Works?
How Spring Framework Really Works?How Spring Framework Really Works?
How Spring Framework Really Works?
 
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.
 
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 

Kürzlich hochgeladen (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

Spring intro classes-in-mumbai

  • 3. Spring Overview • Spring is an open source layered Java/J2EE application framework • Created by Rod Johnson • Based on book “Expert one-on-one J2EE Design and Development” (October, 2002) • Current version 2.0.6 (released on 2007-06-18) • The Spring Framework is licensed under the terms of the Apache License, Version 2.0 and can be downloaded at: • http://www.springframework.org/download • Philosophy: J2EE should be easier to use, “Lightweight Container” concept A software framework is a re-usable design for a software system. Vibrant Technology & Computers 3
  • 4. What are Lightweight Frameworks? • Non-intrusive • No container requirements • Simplify application development • Remove re-occurring pattern code • Productivity friendly • Unit test friendly • Very pluggable • Usually open source • Examples: • Spring, Pico, Hivemind • Hibernate, IBatis, Castor • WebWork • Quartz • Sitemesh Vibrant Technology & Computers 4
  • 5. Spring Mission Statement • J2EE should be easier to use • It's 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 framework shouldn't force you to catch exceptions you're unlikely to be able to recover from. • Testability is essential, and a framework such as Spring should help make your code easier to test • 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 and Hibernate are great O/R mapping solutions. Don't need to develop another one). Vibrant Technology & Computers 5
  • 6. Modules of the Spring Framework The Spring Framework can be considered as a collection of frameworks-in-the-framework: • Core - Inversion of Control (IoC) and Dependency Injection • AOP - Aspect-oriented programming • DAO - Data Access Object support, transaction management, JDBC-abstraction • ORM - Object Relational Mapping data access, integration layers for JPA, JDO, Hibernate, and iBatis • MVC - Model-View-Controller implementation for web- applications • Remote Access, Authentication and Authorization, Remote Management, Messaging Framework, Web Services, Email, Testing, … Vibrant Technology & Computers 6
  • 7. Overview of the Spring Framework Very loosely coupled, components widely reusable and separately packaged. Vibrant Technology & Computers 7
  • 8. Spring Details • Spring allows to decouple software layers by injecting a component’s dependencies at runtime rather than having them declared at compile time via importing and instantiating classes. • Spring provides integration for J2EE services such as EJB, JDBC, JNDI, JMS, JTA. It also integrates several popular ORM toolkits such as Hibernate and JDO and assorted other services as well. • One of the highly touted features is declarative transactions, which allows the developer to write transaction-unaware code and configure transactions in Spring config files. • Spring is built on the principle of unchecked exception handling. This also reduces code dependencies between layers. Spring provides a granular exception hierarchy for data access operations and maps JDBC, EJB, and ORM exceptions to Spring exceptions so that applications can get better information about the error condition. • With highly decoupled software layers and programming to interfaces, each layer is easier to test. Mock objects is a testing pattern that is very useful in this regard. Vibrant Technology & Computers 8
  • 9. Advantages of Spring Architecture • 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, proliferation of pointless classes (locators/delegates); Spring eliminates them • Cross-cutting behavior (resource management is cross-cutting concern, easy to copy-and-paste everywhere) • Portable (can use server-side in web/ejb app, client-side in swing app, business logic is completely portable) Vibrant Technology & Computers 9
  • 10. Spring Solutions • Solutions address major J2EE problem areas: • Web application development (MVC) • Enterprise Java Beans (EJB, JNDI) • Database access (JDBC, iBatis, ORM) • Transaction management (JTA, Hibernate, JDBC) • Remote access (Web Services, RMI) • Each solution builds on the core architecture • Solutions foster integration, they do not re-invent the wheel Vibrant Technology & Computers 10
  • 11. How to Start Using Spring • Download Spring from www.springframework.org, e.g. spring-framework-2.0.6-with-dependencies.zip • Unzip to some location, e.g. C:toolsspring-framework-2.0.6 • Folder C:toolsspring-framework-2.0.6dist contains Spring distribution jar files • Add libraries to your application classpath and start programming with Spring Vibrant Technology & Computers 11
  • 12. Inversion of Control (IoC) • Central in the Spring is its Inversion of Control container • Based on “Inversion of Control Containers and the Dependency Injection pattern” (Martin Fowler) • Provides centralized, automated configuration, managing and wiring of application Java objects • Container responsibilities: • creating objects, • configuring objects, • calling initialization methods • passing objects to registered callback objects • etc • All together form the object lifecycle which is one of the most important features Java objects that are managed by the Spring IoC container are referred to as beans Vibrant Technology & Computers 12
  • 13. Dependency Injection – Non-IoC public class MainBookmarkProcessor implements BookmarkProcessor{ private PageDownloader pageDownloader; private RssParser rssParser; public List<Bookmark> loadBookmarks() { // direct initialization pageDownloader = new ApachePageDownloader(); rssParser = new JenaRssParser(); // or factory initialization // pageDownloader = PageDownloaderFactory.getPageDownloader(); // rssParser = RssParserFactory.getRssParser(); // use initialized objects pageDownloader.downloadPage(url); rssParser.extractBookmarks(fileName, resourceName); // ... } Vibrant Technology & Computers 13
  • 14. Dependency Injection - IoC • Beans define their dependencies through constructor arguments or properties • Container resolves (injects) dependencies of components by setting implementation object during runtime • BeanFactory interface - the core that loads bean definitions and manages beans • Most commonly used implementation is the XmlBeanFactory class • Allows 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 Vibrant Technology & Computers 14
  • 15. Non-IoC versus IoC Non Inversion of Control approach Inversion of Control approach Vibrant Technology & Computers 15
  • 16. IoC Basics • Basic JavaBean pattern: • include a “getter” and “setter” method for each field: • Rather than locating needed resources, application components provide setters through which resources are passed in during initialization • In Spring Framework, this pattern is used extensively, and initialization is usually done through configuration file rather than application code class MyBean { private int counter; public int getCounter() { return counter; } public void setCounter(int counter) { this.counter = counter; } } Vibrant Technology & Computers 16
  • 17. IoC Java Bean public class MainBookmarkProcessor implements BookmarkProcessor{ private PageDownloader pageDownloader; private RssParser rssParser; public List<Bookmark> loadBookmarks() { pageDownloader.downloadPage(url); rssParser.extractBookmarks(fileName, resourceName); // ... } public void setPageDownloader(PageDownloader pageDownloader){ this.pageDownloader = pageDownloader; } public void setRssParser(RssParser rssParser){ this.rssParser = rssParser; } Vibrant Technology & Computers 17
  • 18. References • Spring Home: http://www.springframework.org • Inversion of Control Containers and the Dependency Injection pattern http://www.martinfowler.com/articles/injection.html • Spring IoC Container: http://static.springframework.org/spring/docs/2.0.x/referenc e/beans.html • Introduction to the Spring Framework by Rod Johnson http://www.theserverside.com/tt/articles/article.tss? l=SpringFramework Vibrant Technology & Computers 18