SlideShare une entreprise Scribd logo
1  sur  38
Spring Framework Dhaval   Shah
Contents ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Why Use Spring? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Why Use Spring? ,[object Object],[object Object],[object Object]
Spring Overview ,[object Object],[object Object],[object Object],[object Object],[object Object]
Spring Framework
Spring DI/IoC ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Spring DI/IoC (Cont’d) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Spring DI/IoC (Cont’d) ,[object Object],<bean id=&quot;exampleBean&quot; class=&quot;examples.ExampleBean&quot;> <property name=&quot;beanOne&quot;><ref bean=&quot;anotherExampleBean&quot;/></property> <property name=&quot;beanTwo&quot;><ref bean=&quot;yetAnotherBean&quot;/></property> <property name=&quot;integerProperty&quot;>1</property> </bean> <bean id=&quot;anotherExampleBean&quot; class=&quot;examples.AnotherBean&quot;/> <bean id=&quot;yetAnotherBean&quot; class=&quot;examples.YetAnotherBean&quot;/> <bean id=&quot;exampleBean&quot; class=&quot;examples.ExampleBean&quot;> <constructor-arg><ref bean=&quot;anotherExampleBean&quot;/></constructor-arg> <constructor-arg><ref bean=&quot;yetAnotherBean&quot;/></constructor-arg> <constructor-arg><value>1</value></constructor-arg> </bean> <bean id=&quot;anotherExampleBean&quot; class=&quot;examples.AnotherBean&quot;/> <bean id=&quot;yetAnotherBean&quot; class=&quot;examples.YetAnotherBean&quot;/>
Spring DI/IoC (Cont’d) ,[object Object]
Dependency Injection (cont'd) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Dependency Injection (cont'd) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Spring AOP
AOP Fundamentals ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
AOP Fundamentals ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
AOP Fundamentals ,[object Object],[object Object],[object Object],[object Object],[object Object]
Spring AOP ,[object Object],Advice Type Interface Description Around org.aopalliance.intercept.MethodInterceptor Intercepts call to the target method Before org.springframework.aop.BeforeAdvice Called before the target method is invoked After org.springframework.aop.AfterReturningAdvice Called after the target method is invoked Throws org.springframework.aop.ThrowsAdvice Called when target method throws an exception
Spring AOP Example
Transactions
Spring Transaction Manager Transaction Manager Implementation Purpose org.springframework.jdbc.datasource.DataSourceTransactionManager Manages transactions on a single JDBC DataSource. org.springframework.orm.hibernate.HibernateTransactionManager Used to manage transactions when Hibernate is the persistence mechanism. org.springframework.orm.jdo.JdoTransactionManager Used to manage transactions when JDO is used for persistence. org.springframework.transaction.jta.JtaTransactionManager Manages transactions using a Java Transaction API (JTA ) implementation. Must be used when a transaction spans multiple resources. org.springframework.orm.ojb.PersistenceBrokerTransactionManager Manages transactions when Apache’s Object Relational Bridge (OJB) is used for persistence.
Transaction Configuration ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Declarative Transactions ,[object Object],[object Object],[object Object]
Injecting Transaction Support <bean id=“reservationService&quot;  class=&quot;org.springframework.transaction.interceptor.TransactionProxyFactoryBean&quot;>  <property name=&quot;transactionManager&quot;> <ref bean=&quot;transactionManager&quot;/> </property>  <property name=&quot;target&quot;><ref local=“reservationServiceTarget&quot;/></property> <property name=&quot;transactionAttributes&quot;>  <props> <prop key=“reserveRoom*&quot;>PROPAGATION_REQUIRED</prop>  <prop key=&quot;*&quot;>PROPAGATION_REQUIRED,readOnly</prop>  </props>  </property>  </bean> Declarative transaction support for single bean
Transaction Autoproxy < bean id=&quot;autoproxy&quot;  class=&quot;org...DefaultAdvisorAutoProxyCreator&quot;> </bean> <bean id=&quot;transactionAdvisor&quot; class=&quot;org...TransactionAttributeSourceAdvisor&quot; autowire =&quot;constructor&quot; > </bean> <bean id=&quot;transactionInterceptor&quot; class=&quot;org...TransactionInterceptor&quot; autowire =&quot;byType&quot;>  </bean> <bean id=&quot;transactionAttributeSource&quot; class=&quot;org...AttributesTransactionAttributeSource&quot; autowire =&quot;constructor&quot;> </bean> <bean id=&quot;attributes&quot; class=&quot;org...CommonsAttributes&quot; /> Caches metadata from classes Generic autoproxy support Applies transaction using transactionManager Invokes interceptor based on attributes
Data Access
Data Access ,[object Object],[object Object],[object Object],[object Object],[object Object]
Hibernate DAO Example public class ReservationDaoImpl extends HibernateDaoSupport  implements ReservationDao { public Reservation getReservation (Long orderId) { return (Reservation)getHibernateTemplate().load(Reservation .class,  orderId); } public void saveReservation (Reservation r) { getHibernateTemplate().saveOrUpdate(r); } public void remove(Reservation Reservation) { getHibernateTemplate().delete(r); }
Hibernate DAO (cont’d) public Reservation[] findReservations(Room room) { List list = getHibernateTemplate().find( &quot;from Reservation reservation “ + “  where reservation.resource =? “ + “  order by reservation.start&quot;, instrument); return (Reservation[]) list.toArray(new Reservation[list.size()]);
Hibernate DAO (cont’d) public Reservation[] findReservations(final DateRange range) { final HibernateTemplate template = getHibernateTemplate(); List list = (List) template.execute(new HibernateCallback() { public Object doInHibernate(Session session) { Query query = session.createQuery( &quot;from Reservation r “ + “  where r.start > :rangeStart and r.start < :rangeEnd “); query.setDate(&quot;rangeStart&quot;, range.getStartDate() query.setDate(&quot;rangeEnd&quot;, range.getEndDate()) return query.list(); } }); return (Reservation[]) list.toArray(new Reservation[list.size()]); } }
Hibernate Example <bean id=&quot;sessionFactory&quot; class=&quot;org.springframework.orm.hibernate.LocalSessionFactoryBean&quot;> <property name=&quot;dataSource&quot;><ref bean=&quot;dataSource&quot;/></property> <property name=&quot;mappingResources&quot;> <list> <value>com/jensenp/Reservation/Room.hbm.xml</value> <value>com/jensenp/Reservation/Reservation.hbm.xml</value> <value>com/jensenp/Reservation/Resource.hbm.xml</value>  </list> </property>  <property name=&quot;hibernateProperties&quot;> <props> <prop key=&quot;hibernate.dialect&quot;>${hibernate.dialect}</prop> <prop key=&quot;hibernate.hbm2ddl.auto&quot;>${hibernate.hbm2ddl.auto} </prop> <prop key=&quot;hibernate.show_sql&quot;>${hibernate.show_sql}</prop> </props> </property> </bean> <bean id=“reservationDao&quot; class=&quot;com.jensenp.Reservation.ReservationDaoImpl&quot;> <property name=&quot;sessionFactory&quot;><ref bean=&quot;sessionFactory&quot;/> </property> </bean>
JDBC Support ,[object Object],[object Object],[object Object],[object Object]
Web Framework
DispatcherServlet ,[object Object],[object Object],[object Object],[object Object]
DispatcherServlet Configuration ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Dispatcher Servlet Configuration ,[object Object],[object Object],[object Object],[object Object]
Controllers ,[object Object],[object Object],[object Object]
Controller Implementations ,[object Object],[object Object],[object Object],[object Object],[object Object]
References ,[object Object],[object Object],[object Object],[object Object]

Contenu connexe

Tendances

Exception Handling: Designing Robust Software in Ruby
Exception Handling: Designing Robust Software in RubyException Handling: Designing Robust Software in Ruby
Exception Handling: Designing Robust Software in RubyWen-Tien Chang
 
Testing untestable Code - PFCongres 2010
Testing untestable Code - PFCongres 2010Testing untestable Code - PFCongres 2010
Testing untestable Code - PFCongres 2010Stephan Hochdörfer
 
Spring training
Spring trainingSpring training
Spring trainingTechFerry
 
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksJSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksMario Heiderich
 
Java 7 new features
Java 7 new featuresJava 7 new features
Java 7 new featuresShivam Goel
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java scriptnanjil1984
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java scriptDivyaKS12
 
Real world dependency injection - DPC10
Real world dependency injection - DPC10Real world dependency injection - DPC10
Real world dependency injection - DPC10Stephan Hochdörfer
 
Random Ruby Tips - Ruby Meetup 27 Jun 2018
Random Ruby Tips - Ruby Meetup 27 Jun 2018Random Ruby Tips - Ruby Meetup 27 Jun 2018
Random Ruby Tips - Ruby Meetup 27 Jun 2018Kenneth Teh
 
PHPSpec & Behat: Two Testing Tools That Write Code For You (#phptek edition)
PHPSpec & Behat: Two Testing Tools That Write Code For You (#phptek edition)PHPSpec & Behat: Two Testing Tools That Write Code For You (#phptek edition)
PHPSpec & Behat: Two Testing Tools That Write Code For You (#phptek edition)Joshua Warren
 

Tendances (17)

Exception Handling: Designing Robust Software in Ruby
Exception Handling: Designing Robust Software in RubyException Handling: Designing Robust Software in Ruby
Exception Handling: Designing Robust Software in Ruby
 
Testing untestable Code - PFCongres 2010
Testing untestable Code - PFCongres 2010Testing untestable Code - PFCongres 2010
Testing untestable Code - PFCongres 2010
 
Spring training
Spring trainingSpring training
Spring training
 
C++ boot camp part 1/2
C++ boot camp part 1/2C++ boot camp part 1/2
C++ boot camp part 1/2
 
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksJSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
 
Java 7 new features
Java 7 new featuresJava 7 new features
Java 7 new features
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java script
 
Javascript Best Practices
Javascript Best PracticesJavascript Best Practices
Javascript Best Practices
 
Wt unit 2 ppts client side technology
Wt unit 2 ppts client side technologyWt unit 2 ppts client side technology
Wt unit 2 ppts client side technology
 
Wt unit 4 server side technology-2
Wt unit 4 server side technology-2Wt unit 4 server side technology-2
Wt unit 4 server side technology-2
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java script
 
Real world dependency injection - DPC10
Real world dependency injection - DPC10Real world dependency injection - DPC10
Real world dependency injection - DPC10
 
Wt unit 5 client &amp; server side framework
Wt unit 5 client &amp; server side frameworkWt unit 5 client &amp; server side framework
Wt unit 5 client &amp; server side framework
 
my test
my testmy test
my test
 
hibernate with JPA
hibernate with JPAhibernate with JPA
hibernate with JPA
 
Random Ruby Tips - Ruby Meetup 27 Jun 2018
Random Ruby Tips - Ruby Meetup 27 Jun 2018Random Ruby Tips - Ruby Meetup 27 Jun 2018
Random Ruby Tips - Ruby Meetup 27 Jun 2018
 
PHPSpec & Behat: Two Testing Tools That Write Code For You (#phptek edition)
PHPSpec & Behat: Two Testing Tools That Write Code For You (#phptek edition)PHPSpec & Behat: Two Testing Tools That Write Code For You (#phptek edition)
PHPSpec & Behat: Two Testing Tools That Write Code For You (#phptek edition)
 

Similaire à Spring overview

Similaire à Spring overview (20)

Jsp
JspJsp
Jsp
 
Jsfsunum
JsfsunumJsfsunum
Jsfsunum
 
Spring 2.0
Spring 2.0Spring 2.0
Spring 2.0
 
สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1
 
Developing Transactional JEE Apps With Spring
Developing Transactional JEE Apps With SpringDeveloping Transactional JEE Apps With Spring
Developing Transactional JEE Apps With Spring
 
Os Leonard
Os LeonardOs Leonard
Os Leonard
 
Spring 2.0
Spring 2.0Spring 2.0
Spring 2.0
 
Migration testing framework
Migration testing frameworkMigration testing framework
Migration testing framework
 
Struts,Jsp,Servlet
Struts,Jsp,ServletStruts,Jsp,Servlet
Struts,Jsp,Servlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 
Uma introdução ao framework Spring
Uma introdução ao framework SpringUma introdução ao framework Spring
Uma introdução ao framework Spring
 
Spring and DWR
Spring and DWRSpring and DWR
Spring and DWR
 
Basic Hibernate Final
Basic Hibernate FinalBasic Hibernate Final
Basic Hibernate Final
 
Struts2
Struts2Struts2
Struts2
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 
Custom Action Framework
Custom Action FrameworkCustom Action Framework
Custom Action Framework
 
Seam Introduction
Seam IntroductionSeam Introduction
Seam Introduction
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Php
 
C:\fakepath\jsp01
C:\fakepath\jsp01C:\fakepath\jsp01
C:\fakepath\jsp01
 

Plus de Dhaval Shah

JVM memory management & Diagnostics
JVM memory management & DiagnosticsJVM memory management & Diagnostics
JVM memory management & DiagnosticsDhaval Shah
 
Transaction boundaries in Microservice Architecture
Transaction boundaries in Microservice ArchitectureTransaction boundaries in Microservice Architecture
Transaction boundaries in Microservice ArchitectureDhaval Shah
 
Anatomy of Test Driven Development
Anatomy of Test Driven DevelopmentAnatomy of Test Driven Development
Anatomy of Test Driven DevelopmentDhaval Shah
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice ArchitectureDhaval Shah
 
OO design principles & heuristics
OO design principles & heuristicsOO design principles & heuristics
OO design principles & heuristicsDhaval Shah
 
Enterprise application performance - Understanding & Learnings
Enterprise application performance - Understanding & LearningsEnterprise application performance - Understanding & Learnings
Enterprise application performance - Understanding & LearningsDhaval Shah
 

Plus de Dhaval Shah (7)

JVM memory management & Diagnostics
JVM memory management & DiagnosticsJVM memory management & Diagnostics
JVM memory management & Diagnostics
 
Transaction boundaries in Microservice Architecture
Transaction boundaries in Microservice ArchitectureTransaction boundaries in Microservice Architecture
Transaction boundaries in Microservice Architecture
 
Anatomy of Test Driven Development
Anatomy of Test Driven DevelopmentAnatomy of Test Driven Development
Anatomy of Test Driven Development
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice Architecture
 
OO design principles & heuristics
OO design principles & heuristicsOO design principles & heuristics
OO design principles & heuristics
 
Enterprise application performance - Understanding & Learnings
Enterprise application performance - Understanding & LearningsEnterprise application performance - Understanding & Learnings
Enterprise application performance - Understanding & Learnings
 
Spring Basics
Spring BasicsSpring Basics
Spring Basics
 

Dernier

ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 

Dernier (20)

ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 

Spring overview

  • 2.
  • 3.
  • 4.
  • 5.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 14.
  • 15.
  • 16.
  • 17.
  • 20. Spring Transaction Manager Transaction Manager Implementation Purpose org.springframework.jdbc.datasource.DataSourceTransactionManager Manages transactions on a single JDBC DataSource. org.springframework.orm.hibernate.HibernateTransactionManager Used to manage transactions when Hibernate is the persistence mechanism. org.springframework.orm.jdo.JdoTransactionManager Used to manage transactions when JDO is used for persistence. org.springframework.transaction.jta.JtaTransactionManager Manages transactions using a Java Transaction API (JTA ) implementation. Must be used when a transaction spans multiple resources. org.springframework.orm.ojb.PersistenceBrokerTransactionManager Manages transactions when Apache’s Object Relational Bridge (OJB) is used for persistence.
  • 21.
  • 22.
  • 23. Injecting Transaction Support <bean id=“reservationService&quot; class=&quot;org.springframework.transaction.interceptor.TransactionProxyFactoryBean&quot;> <property name=&quot;transactionManager&quot;> <ref bean=&quot;transactionManager&quot;/> </property> <property name=&quot;target&quot;><ref local=“reservationServiceTarget&quot;/></property> <property name=&quot;transactionAttributes&quot;> <props> <prop key=“reserveRoom*&quot;>PROPAGATION_REQUIRED</prop> <prop key=&quot;*&quot;>PROPAGATION_REQUIRED,readOnly</prop> </props> </property> </bean> Declarative transaction support for single bean
  • 24. Transaction Autoproxy < bean id=&quot;autoproxy&quot; class=&quot;org...DefaultAdvisorAutoProxyCreator&quot;> </bean> <bean id=&quot;transactionAdvisor&quot; class=&quot;org...TransactionAttributeSourceAdvisor&quot; autowire =&quot;constructor&quot; > </bean> <bean id=&quot;transactionInterceptor&quot; class=&quot;org...TransactionInterceptor&quot; autowire =&quot;byType&quot;> </bean> <bean id=&quot;transactionAttributeSource&quot; class=&quot;org...AttributesTransactionAttributeSource&quot; autowire =&quot;constructor&quot;> </bean> <bean id=&quot;attributes&quot; class=&quot;org...CommonsAttributes&quot; /> Caches metadata from classes Generic autoproxy support Applies transaction using transactionManager Invokes interceptor based on attributes
  • 26.
  • 27. Hibernate DAO Example public class ReservationDaoImpl extends HibernateDaoSupport implements ReservationDao { public Reservation getReservation (Long orderId) { return (Reservation)getHibernateTemplate().load(Reservation .class, orderId); } public void saveReservation (Reservation r) { getHibernateTemplate().saveOrUpdate(r); } public void remove(Reservation Reservation) { getHibernateTemplate().delete(r); }
  • 28. Hibernate DAO (cont’d) public Reservation[] findReservations(Room room) { List list = getHibernateTemplate().find( &quot;from Reservation reservation “ + “ where reservation.resource =? “ + “ order by reservation.start&quot;, instrument); return (Reservation[]) list.toArray(new Reservation[list.size()]);
  • 29. Hibernate DAO (cont’d) public Reservation[] findReservations(final DateRange range) { final HibernateTemplate template = getHibernateTemplate(); List list = (List) template.execute(new HibernateCallback() { public Object doInHibernate(Session session) { Query query = session.createQuery( &quot;from Reservation r “ + “ where r.start > :rangeStart and r.start < :rangeEnd “); query.setDate(&quot;rangeStart&quot;, range.getStartDate() query.setDate(&quot;rangeEnd&quot;, range.getEndDate()) return query.list(); } }); return (Reservation[]) list.toArray(new Reservation[list.size()]); } }
  • 30. Hibernate Example <bean id=&quot;sessionFactory&quot; class=&quot;org.springframework.orm.hibernate.LocalSessionFactoryBean&quot;> <property name=&quot;dataSource&quot;><ref bean=&quot;dataSource&quot;/></property> <property name=&quot;mappingResources&quot;> <list> <value>com/jensenp/Reservation/Room.hbm.xml</value> <value>com/jensenp/Reservation/Reservation.hbm.xml</value> <value>com/jensenp/Reservation/Resource.hbm.xml</value> </list> </property> <property name=&quot;hibernateProperties&quot;> <props> <prop key=&quot;hibernate.dialect&quot;>${hibernate.dialect}</prop> <prop key=&quot;hibernate.hbm2ddl.auto&quot;>${hibernate.hbm2ddl.auto} </prop> <prop key=&quot;hibernate.show_sql&quot;>${hibernate.show_sql}</prop> </props> </property> </bean> <bean id=“reservationDao&quot; class=&quot;com.jensenp.Reservation.ReservationDaoImpl&quot;> <property name=&quot;sessionFactory&quot;><ref bean=&quot;sessionFactory&quot;/> </property> </bean>
  • 31.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.

Notes de l'éditeur

  1. Template closures JDBC support also provided