SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
Spring framework
                     Motto: Musíte rozbít vejce když chcete udělat omeletu




                Spring framework training materials by Roman Pichlík is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Sunday 13 May 2012                                                                                                                                       1
Java EE
                     Kurz jak používat Java EE a nezbláznit se z toho




Sunday 13 May 2012                                                      2
Co Spring nabízí
                     • EJB
                     • JMS
                     • JNDI
                     • JCA
                     • Remoting
                     • Napojení na služby

Sunday 13 May 2012                              3
EJB

                     • Zjednoduššené vytváření EJB
                      • SLSB, SLFB, MDB
                        • AbstractStatelessSessionBean
                        • AbstractStatefulSessionBean
                        • AbstractJmsMessageDrivenBean


Sunday 13 May 2012                                       4
Jak na vlastní beanu




Sunday 13 May 2012                          5
Vlastní business rozhraní


  public interface ReservationService {

  	
  	    public boolean reserveBook(Long bookId, Date from, Date to, User user);	
  	
  }




Sunday 13 May 2012                                                                6
Implementace

  @Service(value="reservationService")
  public class ReservationServiceImpl implements ReservationService {
  	
  	 @Autowired
  	 private BookService bookService;

  	    public boolean reserveBook(Long bookId, Date from, Date to, User user) {
  	    	 Book book = bookService.getBook(bookId);
  	    	 if(book == null) {
  	    	 	 throw new RuntimeException("Sorry, the book doesn't exist");
  	    	 }
  	    	 return true;
  	    }
  }




Sunday 13 May 2012                                                                7

Spring bean, mozno testovat
EJB facade




Sunday 13 May 2012                8
Vlastní fasáda
   Předek, zaručující Spring                            EJB má stejné rozhraní
           podport                                        jako Spring beana
  public class ReservationServiceEJBFacade extends
                               AbstractStatelessSessionBean implements ReservationService {
  	
  	 private static final long serialVersionUID = 1L;

  	    private ReservationService reservationService;                       Získání spring
  	    @Override                                                                beany
  	    protected void onEjbCreate() throws CreateException {
  	    	 reservationService = getBeanFactory().getBean("reservationService");	
  	    }

  	    public boolean reserveBook(Long bookId, Date from, Date to, User user) {	 	
  	    	 return reservationService.reserveBook(bookId, from, to, user);
  	    }	
  }




Sunday 13 May 2012                                                                            9

-stejny business interface nam umuznuje delegovat volani
Home a Local Interface
  import javax.ejb.CreateException;
  import javax.ejb.EJBLocalHome;

  public interface ReservationServiceHome extends EJBLocalHome {

  	    public ReservationServiceLocal create() throws CreateException;
  }




  import javax.ejb.EJBLocalObject;

  import cz.sweb.pichlik.ReservationService;

  public interface ReservationServiceLocal extends EJBLocalObject, ReservationService   {
  }




Sunday 13 May 2012                                                                          10
Jak se Spring startuje
  <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/
  XMLSchema-instance"
  	 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-
  jar_2_1.xsd"
  	 version="2.1" id="ejb-jar_ID">
  	 <description>Book service EJB facade</description>
  	 <display-name>ejbs</display-name>                Určuje kontext, který se bude
  	 <enterprise-beans>                                         bootovat
  	 	 <session>
  	 	 	 <description>Book service EJB facade</description>
  	 	 	 <ejb-name>ReservationServiceEJBFacade</ejb-name>
  	 	 	 <local-home>cz.sweb.pichlik.ejb.ReservationServiceHome</local-home>
  	 	 	 <local>cz.sweb.pichlik.ejb.ReservationServiceLocal</local>
  	 	 	 <ejb-class>cz.sweb.pichlik.ejb.ReservationServiceEJBFacade</ejb-class>
  	 	 	 <session-type>Stateless</session-type>
  	 	 	 <transaction-type>Container</transaction-type>	    	 	
  	 	 	 <env-entry>
  	 	 	 	 <env-entry-name>ejb/BeanFactoryPath</env-entry-name>
  	 	 	 	 <env-entry-type>java.lang.String</env-entry-type>
  	 	 	 	 <env-entry-value>classpath*:META-INF/businessContext.xml</env-entry-value>
  	 	 	 </env-entry>
  	 	 </session>
Sunday 13 May 2012                                                                         11

- kazda instance beany si vytvari vlastni kontext.
JNDI




Sunday 13 May 2012          12
Lookup generic, local&remote
  <jee:jndi-lookup id="simple"
               jndi-name="jdbc/MyDataSource"
               cache="true"
               resource-ref="true"
               lookup-on-startup="false"
               expected-type=""
               proxy-interface="com.myapp.Foo"/>

  <jee:local-slsb id="complexLocalEjb"
      jndi-name="ejb/RentalServiceBean"
      business-interface="com.foo.service.RentalService"
      cache-home="true"
      lookup-home-on-startup="true"
      resource-ref="true">

  <jee:remote-slsb id="complexRemoteEjb"
      jndi-name="ejb/MyRemoteBean"
      business-interface="com.foo.service.RentalService"
      cache-home="true"
      lookup-home-on-startup="true"
      resource-ref="true"
      home-interface="com.foo.service.RentalService"
      refresh-home-on-connect-failure="true">
Sunday 13 May 2012                                         13
Remoting




Sunday 13 May 2012              14
Podporované protokoly

                     • Client/Server
                      • RMI
                      • Hessian/Burlap
                      • HttpInvoker
                      • JAX-RPC, JAX-WS


Sunday 13 May 2012                           15
HttpInvoker service
     <servlet>
                                                                        web.xml
       <servlet-name>remoting</servlet-name>
       <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
     </servlet>

     <servlet-mapping>
       <servlet-name>remoting</servlet-name>
       <url-pattern>/remoting/*</url-pattern>
     </servlet-mapping>




                                        remoting-servlet.xml

  <bean name="/ReservationService"
  class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
    	 <property name="service" ref="web.reservationService"/>
       	 <property name="serviceInterface" value="cz.sweb.pichlik.ReservationService"/>
  </bean>



Sunday 13 May 2012                                                                        16
HttpInvoker client


  <bean id="client.reservationService"
  class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
     <property name="serviceUrl" value="http://localhost:8080/servlet/remoting/ReservationService"/>
     <property name="serviceInterface" value="cz.sweb.pichlik.ReservationService"/>
  </bean>




Sunday 13 May 2012                                                                                     17
JMS




Sunday 13 May 2012         18
Podporované typy


                     • MDB
                        • AbstractJmsMessageDrivenBean
                     • Spring MDB
                     • Client


Sunday 13 May 2012                                       19
Mail




Sunday 13 May 2012          20
import org.springframework.mail.SimpleMailMessage;
 import org.springframework.mail.MailSender;

 @Service
 public class EmailExample {

     @Autowired
     private MailSender mailSender;
     @Autowired
     private SimpleMailMessage templateMessage;

     public void sayHello() {
         SimpleMailMessage msg = new SimpleMailMessage(this.templateMessage);
         msg.setTo(order.getCustomer().getEmailAddress());
         msg.setText(“HelloWorld”);
         this.mailSender.send(msg);
     }
 }




 <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
   <property name="host" value="mail.mycompany.com"/>
 </bean>

 <!-- this is a template message that we can pre-load with default state -->
 <bean id="templateMessage" class="org.springframework.mail.SimpleMailMessage">
   <property name="from" value="customerservice@mycompany.com"/>
   <property name="subject" value="Your order"/>
 </bean>




Sunday 13 May 2012                                                                     21
org.springframework.mail.javamail.MimeMessageHelp
er

Más contenido relacionado

Similar a Spring J2EE

J2EE - Practical Overview
J2EE - Practical OverviewJ2EE - Practical Overview
J2EE - Practical Overview
Svetlin Nakov
 
Java script performance tips
Java script performance tipsJava script performance tips
Java script performance tips
Shakti Shrestha
 
Enterprise Java Beans( E)
Enterprise  Java  Beans( E)Enterprise  Java  Beans( E)
Enterprise Java Beans( E)
vikram singh
 
Enterprise java beans(ejb)
Enterprise java beans(ejb)Enterprise java beans(ejb)
Enterprise java beans(ejb)
vikram singh
 
Enterprise java beans(ejb) update 2
Enterprise java beans(ejb) update 2Enterprise java beans(ejb) update 2
Enterprise java beans(ejb) update 2
vikram singh
 
Enterprise java beans(ejb) Update 2
Enterprise java beans(ejb) Update 2Enterprise java beans(ejb) Update 2
Enterprise java beans(ejb) Update 2
vikram singh
 
Enterprise java beans(ejb)
Enterprise java beans(ejb)Enterprise java beans(ejb)
Enterprise java beans(ejb)
vikram singh
 
Enterprise java beans(ejb) update 2
Enterprise java beans(ejb) update 2Enterprise java beans(ejb) update 2
Enterprise java beans(ejb) update 2
vikram singh
 

Similar a Spring J2EE (20)

GIDS 2012: Java Message Service 2.0
GIDS 2012: Java Message Service 2.0GIDS 2012: Java Message Service 2.0
GIDS 2012: Java Message Service 2.0
 
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012
 
Jsf2 overview
Jsf2 overviewJsf2 overview
Jsf2 overview
 
J2EE - Practical Overview
J2EE - Practical OverviewJ2EE - Practical Overview
J2EE - Practical Overview
 
Enterprise JavaBeans(EJB)
Enterprise JavaBeans(EJB)Enterprise JavaBeans(EJB)
Enterprise JavaBeans(EJB)
 
J2 Ee Overview
J2 Ee OverviewJ2 Ee Overview
J2 Ee Overview
 
14 mvc
14 mvc14 mvc
14 mvc
 
EJB 3.1 and GlassFish v3 Prelude
EJB 3.1 and GlassFish v3 PreludeEJB 3.1 and GlassFish v3 Prelude
EJB 3.1 and GlassFish v3 Prelude
 
Java script performance tips
Java script performance tipsJava script performance tips
Java script performance tips
 
Enterprise Java Beans( E)
Enterprise  Java  Beans( E)Enterprise  Java  Beans( E)
Enterprise Java Beans( E)
 
GlassFish REST Administration Backend
GlassFish REST Administration BackendGlassFish REST Administration Backend
GlassFish REST Administration Backend
 
Enterprise java beans(ejb)
Enterprise java beans(ejb)Enterprise java beans(ejb)
Enterprise java beans(ejb)
 
10 J D B C
10  J D B C10  J D B C
10 J D B C
 
JAVA SERVER PAGES
JAVA SERVER PAGESJAVA SERVER PAGES
JAVA SERVER PAGES
 
Enterprise java beans(ejb) update 2
Enterprise java beans(ejb) update 2Enterprise java beans(ejb) update 2
Enterprise java beans(ejb) update 2
 
Enterprise java beans(ejb) Update 2
Enterprise java beans(ejb) Update 2Enterprise java beans(ejb) Update 2
Enterprise java beans(ejb) Update 2
 
Spring database - part2
Spring database -  part2Spring database -  part2
Spring database - part2
 
Enterprise java beans(ejb)
Enterprise java beans(ejb)Enterprise java beans(ejb)
Enterprise java beans(ejb)
 
Enterprise java beans(ejb) update 2
Enterprise java beans(ejb) update 2Enterprise java beans(ejb) update 2
Enterprise java beans(ejb) update 2
 

Más de Roman Pichlík (9)

Spring ioc-advanced
Spring ioc-advancedSpring ioc-advanced
Spring ioc-advanced
 
Spring integration
Spring integrationSpring integration
Spring integration
 
Spring dao
Spring daoSpring dao
Spring dao
 
Spring aop
Spring aopSpring aop
Spring aop
 
Spring Web Services
Spring Web ServicesSpring Web Services
Spring Web Services
 
MongoDB for Java Developers
MongoDB for Java DevelopersMongoDB for Java Developers
MongoDB for Java Developers
 
Nosql from java developer pov
Nosql from java developer povNosql from java developer pov
Nosql from java developer pov
 
Spring framework - J2EE S Lidskou Tvari
Spring framework - J2EE S Lidskou TvariSpring framework - J2EE S Lidskou Tvari
Spring framework - J2EE S Lidskou Tvari
 
Dependency Injection Frameworky
Dependency Injection FrameworkyDependency Injection Frameworky
Dependency Injection Frameworky
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+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...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
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
panagenda
 

Último (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
+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...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
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
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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
 

Spring J2EE

  • 1. Spring framework Motto: Musíte rozbít vejce když chcete udělat omeletu Spring framework training materials by Roman Pichlík is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Sunday 13 May 2012 1
  • 2. Java EE Kurz jak používat Java EE a nezbláznit se z toho Sunday 13 May 2012 2
  • 3. Co Spring nabízí • EJB • JMS • JNDI • JCA • Remoting • Napojení na služby Sunday 13 May 2012 3
  • 4. EJB • Zjednoduššené vytváření EJB • SLSB, SLFB, MDB • AbstractStatelessSessionBean • AbstractStatefulSessionBean • AbstractJmsMessageDrivenBean Sunday 13 May 2012 4
  • 5. Jak na vlastní beanu Sunday 13 May 2012 5
  • 6. Vlastní business rozhraní public interface ReservationService { public boolean reserveBook(Long bookId, Date from, Date to, User user); } Sunday 13 May 2012 6
  • 7. Implementace @Service(value="reservationService") public class ReservationServiceImpl implements ReservationService { @Autowired private BookService bookService; public boolean reserveBook(Long bookId, Date from, Date to, User user) { Book book = bookService.getBook(bookId); if(book == null) { throw new RuntimeException("Sorry, the book doesn't exist"); } return true; } } Sunday 13 May 2012 7 Spring bean, mozno testovat
  • 8. EJB facade Sunday 13 May 2012 8
  • 9. Vlastní fasáda Předek, zaručující Spring EJB má stejné rozhraní podport jako Spring beana public class ReservationServiceEJBFacade extends AbstractStatelessSessionBean implements ReservationService { private static final long serialVersionUID = 1L; private ReservationService reservationService; Získání spring @Override beany protected void onEjbCreate() throws CreateException { reservationService = getBeanFactory().getBean("reservationService"); } public boolean reserveBook(Long bookId, Date from, Date to, User user) { return reservationService.reserveBook(bookId, from, to, user); } } Sunday 13 May 2012 9 -stejny business interface nam umuznuje delegovat volani
  • 10. Home a Local Interface import javax.ejb.CreateException; import javax.ejb.EJBLocalHome; public interface ReservationServiceHome extends EJBLocalHome { public ReservationServiceLocal create() throws CreateException; } import javax.ejb.EJBLocalObject; import cz.sweb.pichlik.ReservationService; public interface ReservationServiceLocal extends EJBLocalObject, ReservationService { } Sunday 13 May 2012 10
  • 11. Jak se Spring startuje <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/ XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb- jar_2_1.xsd" version="2.1" id="ejb-jar_ID"> <description>Book service EJB facade</description> <display-name>ejbs</display-name> Určuje kontext, který se bude <enterprise-beans> bootovat <session> <description>Book service EJB facade</description> <ejb-name>ReservationServiceEJBFacade</ejb-name> <local-home>cz.sweb.pichlik.ejb.ReservationServiceHome</local-home> <local>cz.sweb.pichlik.ejb.ReservationServiceLocal</local> <ejb-class>cz.sweb.pichlik.ejb.ReservationServiceEJBFacade</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> <env-entry> <env-entry-name>ejb/BeanFactoryPath</env-entry-name> <env-entry-type>java.lang.String</env-entry-type> <env-entry-value>classpath*:META-INF/businessContext.xml</env-entry-value> </env-entry> </session> Sunday 13 May 2012 11 - kazda instance beany si vytvari vlastni kontext.
  • 13. Lookup generic, local&remote <jee:jndi-lookup id="simple" jndi-name="jdbc/MyDataSource" cache="true" resource-ref="true" lookup-on-startup="false" expected-type="" proxy-interface="com.myapp.Foo"/> <jee:local-slsb id="complexLocalEjb" jndi-name="ejb/RentalServiceBean" business-interface="com.foo.service.RentalService" cache-home="true" lookup-home-on-startup="true" resource-ref="true"> <jee:remote-slsb id="complexRemoteEjb" jndi-name="ejb/MyRemoteBean" business-interface="com.foo.service.RentalService" cache-home="true" lookup-home-on-startup="true" resource-ref="true" home-interface="com.foo.service.RentalService" refresh-home-on-connect-failure="true"> Sunday 13 May 2012 13
  • 15. Podporované protokoly • Client/Server • RMI • Hessian/Burlap • HttpInvoker • JAX-RPC, JAX-WS Sunday 13 May 2012 15
  • 16. HttpInvoker service <servlet> web.xml <servlet-name>remoting</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>remoting</servlet-name> <url-pattern>/remoting/*</url-pattern> </servlet-mapping> remoting-servlet.xml <bean name="/ReservationService" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter"> <property name="service" ref="web.reservationService"/> <property name="serviceInterface" value="cz.sweb.pichlik.ReservationService"/> </bean> Sunday 13 May 2012 16
  • 17. HttpInvoker client <bean id="client.reservationService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"> <property name="serviceUrl" value="http://localhost:8080/servlet/remoting/ReservationService"/> <property name="serviceInterface" value="cz.sweb.pichlik.ReservationService"/> </bean> Sunday 13 May 2012 17
  • 18. JMS Sunday 13 May 2012 18
  • 19. Podporované typy • MDB • AbstractJmsMessageDrivenBean • Spring MDB • Client Sunday 13 May 2012 19
  • 21. import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.MailSender; @Service public class EmailExample { @Autowired private MailSender mailSender; @Autowired private SimpleMailMessage templateMessage; public void sayHello() { SimpleMailMessage msg = new SimpleMailMessage(this.templateMessage); msg.setTo(order.getCustomer().getEmailAddress()); msg.setText(“HelloWorld”); this.mailSender.send(msg); } } <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> <property name="host" value="mail.mycompany.com"/> </bean> <!-- this is a template message that we can pre-load with default state --> <bean id="templateMessage" class="org.springframework.mail.SimpleMailMessage"> <property name="from" value="customerservice@mycompany.com"/> <property name="subject" value="Your order"/> </bean> Sunday 13 May 2012 21 org.springframework.mail.javamail.MimeMessageHelp er