SlideShare ist ein Scribd-Unternehmen logo
1 von 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]

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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)
 

Ähnlich wie Spring overview

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Kürzlich hochgeladen (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

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.

Hinweis der Redaktion

  1. Template closures JDBC support also provided