SlideShare una empresa de Scribd logo
1 de 39
Descargar para leer sin conexión
Spring Framework 3.0
                                                      Alef Arendsen




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Agenda

• Configuration options in 1.0, 2.0, 2.5 and 3.0
• Introduction of REST support in Spring MVC
• Migration of OXM from WS to Spring Framework
• Introduction of expression language support
• Other features and considerations for Spring 3.0




                                                                                                                     2
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Agenda

• Configuration options in 1.0, 2.0, 2.5 and 3.0
• Introduction of REST support in Spring MVC
• Migration of OXM from WS to Spring Framework
• Introduction of expression language support
• Other features and considerations for Spring 3.0




                                                                                                                     3
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Spring 1.0 <beans/> schema


<?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
<beans xmlns=quot;http://www.springframework.org/schema/beansquot;
    xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
    xsi:schemaLocation=quot;...quot;>

   <bean id=quot;clinicquot;
    	


	 	 class=quot;org.springframework.samples.petclinic.JdbcClinicquot;>
       <constructor-arg ref=quot;dataSourcequot;/>
    </bean>
</beans>




                                                                                                                     4
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Spring 2.0 schema support


<?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
<beans xmlns=quot;http://www.springframework.org/schema/beansquot;
    xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
    xmlns:tx=quot;http://www.springframework.org/schema/txquot;
    xsi:schemaLocation=quot;...quot;>

    <tx:annotation-driven
    		   base-package=quot;org.springframework.samples.petclinicquot;/>

</beans>




                                                                                                                     5
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Spring 2.5 annotations

             @Transactional @Repository
             public class HibernateClinic implements Clinic {
             	
             	 private SessionFactory sessionFactory;

             	         @Autowired public HibernateClinic(
                              SessionFactory sessionFactory) {
             	         	 this.sessionFactory = sessionFactory;
             	         }
             }




                                                                                                                     6
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Component scanning


<?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
<beans xmlns=quot;http://www.springframework.org/schema/beansquot;
    xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
    xmlns:context=quot;http://www.springframework.org/schema/contextquot;
    xsi:schemaLocation=quot;...quot;>

    <context:component-scan
    		   base-package=quot;org.springframework.samples.petclinicquot;/>

</beans>




                                                                                                                     7
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
@Controller for Spring MVC

        @Controller
        public class ClinicController {

        	         private final Clinic clinic;

        	         @Autowired	 public ClinicController(Clinic clinic)
        {
        	         	          this.clinic = clinic;
        	         }

            ...
        }




                                                                                                                     8
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
@RequestMapping methods

        @Controller
        public class ClinicController {

            ...

       	      @RequestMapping(quot;/vetsquot;)
       	      public List<Vet> vets() {
       	      	 return clinic.getVets();
       	      }
       }




                                                                                                                     9
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Constantly simplifying

       • LoC for sample application PetClinic over
         time
                        Spring 2.0                                                         Spring 2.5




                                                                                                                     10
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Spring as a foundation

         • Other technologies building on the Spring
           foundation
                         •Spring Batch 2.0 (e.g. with @BatchComponent)
                         •Spring Integration 1.0 (e.g. with @MessageEndpoint)
                         •Spring Web Services (e.g. with @Endpoint)
                         •...


         • Most projects feature annotation-based
           options as well as XML-based ones



                                                                                                                     11
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Other portfolio example:
  Spring Integration 1.0 - dec08

         • Relatively new project under the Spring
           Portfolio umbrella
         • Focuses on in-VM lightweight integration
           scenarios
                 –asynchronous messaging in a single VM
                 –with adapters for many formats to integrate
                  with external systems
                  (JMS, Email, File, et cetera)
         • Implement of the Patterns of Enterprise
           Application Integration (Hohpe et. al.)

                                                                                                                     12
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
@MessageEndpoint

       @MessageEndpoint
       public class OrderSplitter {

       	         @Splitter(inputChannel=quot;ordersquot;,
                        outputChannel=quot;drinksquot;)
       	         public List<OrderItem> split(Order order) {
       	         	 return order.getItems();
       	         }
       }




                                                                                                                     13
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
@MessageEndpoint

 <si:splitter input-channel=quot;ordersquot;
   output-channel=quot;drinksquot;
   ref=quot;orderSplitterquot; method=quot;splitquot; />

 <bean id=quot;orderSplitterquot;
     class=quot;org.sfw.integration..xml.OrderSplitterquot;/>

                                                                                                                            Look ma,
                                                                                                                            no annotations!

                                                                                       public class OrderSplitter {

                                                                                       	         public List<OrderItem> split(Order order) {
                                                                                       	         	    return order.getItems();
                                                                                       	         }
                                                                                       }


                                                                                                                                      14
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
New in Spring 3.0

         • Previously available in a separate project
           (Spring JavaConfig)
         • Has been available in prototype form since
           early 2005
         • Now promoted to the core
           Spring Framework




                                                                                                                     15
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Spring 1.0 <beans/> schema


<?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
<beans xmlns=quot;http://www.springframework.org/schema/beansquot;
    xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
    xsi:schemaLocation=quot;...quot;>

   <bean id=quot;clinicquot;
    	


	 	 class=quot;org.springframework.samples.petclinic.JdbcClinicquot;>
       <constructor-arg ref=quot;dataSourcequot;/>
    </bean>
</beans>




                                                                                                                     16
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
JavaConfig in Action


@Configuration
public abstract class MyConfig {
	
	 @Bean public Clinic clinic() {
	 	 DataSource ds = dataSource();
	 	 return new JdbcClinic(ds);
	}                                                                                                                   One method
                                                                                                                      per bean

	 @Autowired public abstract DataSource dataSource();

}



                                                                                                                          17
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Agenda

• Configuration options in 1.0, 2.0, 2.5 and 3.0
• Introduction of REST support in Spring MVC
• Migration of OXM from WS to Spring Framework
• Introduction of expression language support
• Other features and considerations for Spring 3.0




                                                                                                                     18
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Summary of REST

• (Ideally) stateless server architecture
• Resources
• Actions / operations on those resources
• Representations




                                                                                                                     19
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
A practical example

         • http://bank.com/account/1234
         • Represents the account resources
                 –GET retrieves the account
                         •GET to bank.com/account/1234 to retrieve
                 –PUT creates or modifies a resource
                         •Post to bank.com/account/1234 to create/update
                 –POST creates a resource
                         •Post to bank.com/account to create a new account
                 –DELETE deletes a resources
                         •DELETE to bank.com/account/1234 to delete or for
                          example deactiveate / cancel

                                                                                                                     20
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Summary of Spring REST

         • URI template support (client & controller)
         • Support for representations
           (HTML, XML, RSS, Atom, PDF, Excel, JSON)
         • Servlet Filter to PUT/DELETE support
         • Built on Spring MVC




                                                                                                                     21
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Support for URI templates

        @Controller
        @RequestMapping(quot;/account/*quot;)
        public class AccountController {	
        	
        	 @RequestMapping(value=quot;/*/{id}quot;,
                                                                                             method=RequestMethod.GET)
        	 public Account get(@PathVariable long id) {
        	 	 // retrieve and return account
        	}
        }
        Handles URL: http://bank.com/account/1234




                                                                                                                         22
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Representations

         • Neatly laid-out support for several
           representations of your data:
                 –HTML (e.g. through FreeMarker or JSPs)
                 –PDF and Excel (POI, JExcelApi, iText)
                 –JSON, RSS, Atom
                 –XML
         • Support for changing the representation
           based on extension or the accept-header



                                                                                                                     23
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Support for PUT and DELETE

         • Most browsers don’t support PUT / DELETE
         • So what about the following:
             @RequestMapping(value=quot;/*/{id}quot;,
             				                  method=RequestMethod.DELETE)
             	 public void delete(@PathVariable long id) {
             	 	 // delete account
             	}




                                                                                                                     24
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Support for PUT and DELETE

         • Most browsers don’t support PUT / DELETE
         • So what about the following:
             @RequestMapping(value=quot;/*/{id}quot;,
             				                  method=RequestMethod.DELETE)
             	 public void delete(@PathVariable long id) {
             	 	 // delete account
             	}

         • Support for PUT and DELETE is added
           through a special ServletFilter (and in
           HTML for example using a hidden
           input field)
                                                                                                                     25
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Agenda

• Recap of Spring 2.5 configuration options and
  @MVC
• Introduction of REST support in Spring MVC
• Migration of OXM to Spring Framework
• Introduction of expression language support
• Other features and considerations for Spring 3.0




                                                                                                                      26
 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Object-XML mapping
   abstraction in Spring

• Mapping objects to XML and vice versa through
   –XmlBeans, JiBX, Castor, JAXB (2), XStream
• Used to be part of Spring WS
• Useful for REST purposes as well
• Moved to core Spring Framework as of 3.0




                                                                                                                      27
 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Interfaces for marshalling and
  unmarshalling

public interface Marshaller {
	
	 public void marshal(Object graph, Result result)
	 throws XmlMappingException, IOException;
}



                               public interface Unmarshaller {
                               	
                               	 public Object unmarshal(Source source)
                               	 throws XmlMappingException, IOException;
                               }

                                                                                                                     28
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Usages throughout portfolio

• JMS (MarshallingMessageConverter
• MVC (MarshallingView)
• Batch
• ...




                                                                                                                      29
 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Agenda

• Recap of Spring 2.5 configuration options and
  @MVC
• Introduction of REST support in Spring MVC
• Migration of OXM from WS to Spring Framework
• Introduction of expression language support
• Other features and considerations for Spring 3.0




                                                                                                                      30
 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Property externalization in 2.5

 • Traditionally using

	 <bean id=quot;dataSourcequot;
       class=quot;org.apache.commons.dbcp.BasicDataSourcequot;
		   	    	   destroy-method=quot;closequot;>
		    <property name=quot;driverClassNamequot; value=quot;${driver}quot;/>
		    <property name=quot;urlquot; value=quot;${url}quot;/>
		    <property name=quot;usernanequot; value=quot;${username}quot;/>
		    <property name=quot;passwordquot; value=quot;${passwordquot;/>
</bean>

     <context:property-placeholder
          location=quot;/WEB-INF/jdbc.propertiesquot;/>




                                                                                                                     31
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Drawbacks of this approach

         • It only supports properties
         • The replacement is done at initialization
           time
                                        »Not at bean creation time
         • It doesn’t support conditionals or other
           constructs
         • It’s not very extensible for other
           frameworks



                                                                                                                     32
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Introducing expressions

         • Spring 3.0 will include full support for the
           unified expression language
         • The replacement is done when the bean is
           created (and not when reading the
           configuration)




                                                                                                                     33
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Introducing expressions

         • Spring 3.0 will include full support for the
           unified expression language
         • The replacement is done when the bean is
           created (and not when reading the
           configuration)
	 <bean id=quot;dataSourcequot;
       class=quot;org.apache.commons.dbcp.BasicDataSourcequot;
		    	   	   destroy-method=quot;closequot; scope=”prototype”>
	         ...
		    <property name=quot;urlquot; value=quot;${systemProperties.url}quot;/>
  </bean>



                                                                                                                     34
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Using expressions in other
  parts of the portfolio

         • An extensible expression language
         • Will be used by other frameworks
                 –Security (example below)
                 –Integration / JMS (e.g. dynamic queue names)
                 –Et cetera

@PreAuthorize(quot;hasRole('ROLE_SUPERVISOR') or quot; +
        quot;hasRole('ROLE_TELLER') and quot; +
        quot;(#account.balance + #amount >= -#account.overdraft)quot; )
public void post(Account account, double amount);



                                                                                                                     35
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Agenda

• Recap of Spring 2.5 configuration options and @MVC
• Introduction of REST support in Spring MVC
• Migration of OXM from WS to Spring Framework
• Introduction of expression language support
• Other features and considerations for Spring 3.0




                                                                                                                     36
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Backwards compatibility

         • Spring 3.0 will deprecate / remove various
           things
                         •Traditional Spring MVC controller hierarchy (??)
                         •Commons Attributes support
                         •Traditional TopLink support
                         •Traditional JUnit 3.8 class hierarchy
         • 95% backwards compatible with regards to
           APIs
         • 99% backwards compatible in the
           programming model

                                                                                                                     37
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Roadmap

         • Spring 3.0 M1 released in December
         • Spring 3.0 M2 to be released any time now
         • Further Milestones later this quarter
         • Spring 3.0 RC and release Q2 2009

         • More information on what features are
           included in which milestones:
           http://jira.springframework.org


                                                                                                                     38
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Questions?




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.

Más contenido relacionado

Destacado

Bản Tin BĐS Việt Nam Số 68 Tuần 1 Tháng 2 Năm 2009
Bản Tin BĐS Việt Nam Số 68 Tuần 1 Tháng 2 Năm 2009Bản Tin BĐS Việt Nam Số 68 Tuần 1 Tháng 2 Năm 2009
Bản Tin BĐS Việt Nam Số 68 Tuần 1 Tháng 2 Năm 2009internationalvr
 
Agrupamento Vertical De Canelas
Agrupamento Vertical De CanelasAgrupamento Vertical De Canelas
Agrupamento Vertical De CanelasNM8G
 
February 11, 2003 Burlington Industries to be Acquired
February 11, 2003     Burlington Industries to be Acquired February 11, 2003     Burlington Industries to be Acquired
February 11, 2003 Burlington Industries to be Acquired finance2
 
May 8, 2003 First Quarter 2003 Interim Report Release Information
May 8, 2003     First Quarter 2003 Interim Report Release Information May 8, 2003     First Quarter 2003 Interim Report Release Information
May 8, 2003 First Quarter 2003 Interim Report Release Information finance2
 
JPMorgan Chase Financial highlights and trends
JPMorgan Chase Financial highlights and trendsJPMorgan Chase Financial highlights and trends
JPMorgan Chase Financial highlights and trendsfinance2
 
Devoxx2011 timesheet day3-4-5
Devoxx2011 timesheet day3-4-5Devoxx2011 timesheet day3-4-5
Devoxx2011 timesheet day3-4-5Stephan Janssen
 

Destacado (6)

Bản Tin BĐS Việt Nam Số 68 Tuần 1 Tháng 2 Năm 2009
Bản Tin BĐS Việt Nam Số 68 Tuần 1 Tháng 2 Năm 2009Bản Tin BĐS Việt Nam Số 68 Tuần 1 Tháng 2 Năm 2009
Bản Tin BĐS Việt Nam Số 68 Tuần 1 Tháng 2 Năm 2009
 
Agrupamento Vertical De Canelas
Agrupamento Vertical De CanelasAgrupamento Vertical De Canelas
Agrupamento Vertical De Canelas
 
February 11, 2003 Burlington Industries to be Acquired
February 11, 2003     Burlington Industries to be Acquired February 11, 2003     Burlington Industries to be Acquired
February 11, 2003 Burlington Industries to be Acquired
 
May 8, 2003 First Quarter 2003 Interim Report Release Information
May 8, 2003     First Quarter 2003 Interim Report Release Information May 8, 2003     First Quarter 2003 Interim Report Release Information
May 8, 2003 First Quarter 2003 Interim Report Release Information
 
JPMorgan Chase Financial highlights and trends
JPMorgan Chase Financial highlights and trendsJPMorgan Chase Financial highlights and trends
JPMorgan Chase Financial highlights and trends
 
Devoxx2011 timesheet day3-4-5
Devoxx2011 timesheet day3-4-5Devoxx2011 timesheet day3-4-5
Devoxx2011 timesheet day3-4-5
 

Similar a BeJUG - Spring 3 talk

Annotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCAnnotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCJohn Lewis
 
Spring training
Spring trainingSpring training
Spring trainingTechFerry
 
What's Coming in Spring 3.0
What's Coming in Spring 3.0What's Coming in Spring 3.0
What's Coming in Spring 3.0Matt Raible
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet Sagar Nakul
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet Sagar Nakul
 
Whoops! where did my architecture go?
Whoops! where did my architecture go?Whoops! where did my architecture go?
Whoops! where did my architecture go?Oliver Gierke
 
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts ApplicationStep by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Applicationelliando dias
 
Whoops! Where did my architecture go?
Whoops! Where did my architecture go?Whoops! Where did my architecture go?
Whoops! Where did my architecture go?Oliver Gierke
 
Struts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web ApplicationsStruts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web Applicationselliando dias
 
Spring Integration and EIP Introduction
Spring Integration and EIP IntroductionSpring Integration and EIP Introduction
Spring Integration and EIP IntroductionIwein Fuld
 
Clustering Made Easier: Using Terracotta with Hibernate and/or EHCache
Clustering Made Easier: Using Terracotta with Hibernate and/or EHCacheClustering Made Easier: Using Terracotta with Hibernate and/or EHCache
Clustering Made Easier: Using Terracotta with Hibernate and/or EHCacheCris Holdorph
 
Terracotta Ch'ti Jug
Terracotta Ch'ti JugTerracotta Ch'ti Jug
Terracotta Ch'ti JugCh'ti JUG
 
Enterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudEnterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudCarlos Sanchez
 
Maven 2.0 - Improve your build patterns
Maven 2.0 - Improve your build patternsMaven 2.0 - Improve your build patterns
Maven 2.0 - Improve your build patternselliando dias
 
Introduction To ASP.NET MVC
Introduction To ASP.NET MVCIntroduction To ASP.NET MVC
Introduction To ASP.NET MVCAlan Dean
 

Similar a BeJUG - Spring 3 talk (20)

Annotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCAnnotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVC
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring training
Spring trainingSpring training
Spring training
 
What's Coming in Spring 3.0
What's Coming in Spring 3.0What's Coming in Spring 3.0
What's Coming in Spring 3.0
 
Struts,Jsp,Servlet
Struts,Jsp,ServletStruts,Jsp,Servlet
Struts,Jsp,Servlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 
Whoops! where did my architecture go?
Whoops! where did my architecture go?Whoops! where did my architecture go?
Whoops! where did my architecture go?
 
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts ApplicationStep by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Application
 
Whoops! Where did my architecture go?
Whoops! Where did my architecture go?Whoops! Where did my architecture go?
Whoops! Where did my architecture go?
 
Struts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web ApplicationsStruts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web Applications
 
JEE5 New Features
JEE5 New FeaturesJEE5 New Features
JEE5 New Features
 
Spring Integration and EIP Introduction
Spring Integration and EIP IntroductionSpring Integration and EIP Introduction
Spring Integration and EIP Introduction
 
Clustering Made Easier: Using Terracotta with Hibernate and/or EHCache
Clustering Made Easier: Using Terracotta with Hibernate and/or EHCacheClustering Made Easier: Using Terracotta with Hibernate and/or EHCache
Clustering Made Easier: Using Terracotta with Hibernate and/or EHCache
 
Terracotta Ch'ti Jug
Terracotta Ch'ti JugTerracotta Ch'ti Jug
Terracotta Ch'ti Jug
 
Lo nuevo en Spring 3.0
Lo nuevo  en Spring 3.0Lo nuevo  en Spring 3.0
Lo nuevo en Spring 3.0
 
Spring Framework - III
Spring Framework - IIISpring Framework - III
Spring Framework - III
 
Enterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudEnterprise Build And Test In The Cloud
Enterprise Build And Test In The Cloud
 
Maven 2.0 - Improve your build patterns
Maven 2.0 - Improve your build patternsMaven 2.0 - Improve your build patterns
Maven 2.0 - Improve your build patterns
 
Introduction To ASP.NET MVC
Introduction To ASP.NET MVCIntroduction To ASP.NET MVC
Introduction To ASP.NET MVC
 

Más de Stephan Janssen

Devoxx speaker training (June 27th, 2018)
Devoxx speaker training (June 27th, 2018)Devoxx speaker training (June 27th, 2018)
Devoxx speaker training (June 27th, 2018)Stephan Janssen
 
The new DeVoxxEd websites with JHipster, Angular & Kubernetes
The new DeVoxxEd websites with JHipster, Angular & KubernetesThe new DeVoxxEd websites with JHipster, Angular & Kubernetes
The new DeVoxxEd websites with JHipster, Angular & KubernetesStephan Janssen
 
The new Voxxed websites with JHipster, Angular and GitLab
The new Voxxed websites  with JHipster, Angular and GitLabThe new Voxxed websites  with JHipster, Angular and GitLab
The new Voxxed websites with JHipster, Angular and GitLabStephan Janssen
 
Devoxx2011 timesheet day1-2
Devoxx2011 timesheet day1-2Devoxx2011 timesheet day1-2
Devoxx2011 timesheet day1-2Stephan Janssen
 

Más de Stephan Janssen (16)

Devoxx speaker training (June 27th, 2018)
Devoxx speaker training (June 27th, 2018)Devoxx speaker training (June 27th, 2018)
Devoxx speaker training (June 27th, 2018)
 
The new DeVoxxEd websites with JHipster, Angular & Kubernetes
The new DeVoxxEd websites with JHipster, Angular & KubernetesThe new DeVoxxEd websites with JHipster, Angular & Kubernetes
The new DeVoxxEd websites with JHipster, Angular & Kubernetes
 
The new Voxxed websites with JHipster, Angular and GitLab
The new Voxxed websites  with JHipster, Angular and GitLabThe new Voxxed websites  with JHipster, Angular and GitLab
The new Voxxed websites with JHipster, Angular and GitLab
 
Java, what's next?
Java, what's next?Java, what's next?
Java, what's next?
 
Programming 4 kids
Programming 4 kidsProgramming 4 kids
Programming 4 kids
 
Devoxx2011 timesheet day1-2
Devoxx2011 timesheet day1-2Devoxx2011 timesheet day1-2
Devoxx2011 timesheet day1-2
 
EJB 3.1 by Bert Ertman
EJB 3.1 by Bert ErtmanEJB 3.1 by Bert Ertman
EJB 3.1 by Bert Ertman
 
BeJUG JAX-RS Event
BeJUG JAX-RS EventBeJUG JAX-RS Event
BeJUG JAX-RS Event
 
Whats New In Java Ee 6
Whats New In Java Ee 6Whats New In Java Ee 6
Whats New In Java Ee 6
 
Glass Fishv3 March2010
Glass Fishv3 March2010Glass Fishv3 March2010
Glass Fishv3 March2010
 
Advanced Scrum
Advanced ScrumAdvanced Scrum
Advanced Scrum
 
Scala by Luc Duponcheel
Scala by Luc DuponcheelScala by Luc Duponcheel
Scala by Luc Duponcheel
 
Intro To OSGi
Intro To OSGiIntro To OSGi
Intro To OSGi
 
Kick Start Jpa
Kick Start JpaKick Start Jpa
Kick Start Jpa
 
BeJUG - Di With Spring
BeJUG - Di With SpringBeJUG - Di With Spring
BeJUG - Di With Spring
 
BeJug.Org Java Generics
BeJug.Org   Java GenericsBeJug.Org   Java Generics
BeJug.Org Java Generics
 

Último

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 challengesrafiqahmad00786416
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
"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 ...Zilliz
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
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
 
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
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
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
 
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
 
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 educationjfdjdjcjdnsjd
 
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 REVIEWERMadyBayot
 
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
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 

Último (20)

+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...
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
"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 ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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...
 
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
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
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
 
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
 
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
 
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
 
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
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

BeJUG - Spring 3 talk

  • 1. Spring Framework 3.0 Alef Arendsen Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 2. Agenda • Configuration options in 1.0, 2.0, 2.5 and 3.0 • Introduction of REST support in Spring MVC • Migration of OXM from WS to Spring Framework • Introduction of expression language support • Other features and considerations for Spring 3.0 2 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 3. Agenda • Configuration options in 1.0, 2.0, 2.5 and 3.0 • Introduction of REST support in Spring MVC • Migration of OXM from WS to Spring Framework • Introduction of expression language support • Other features and considerations for Spring 3.0 3 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 4. Spring 1.0 <beans/> schema <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <beans xmlns=quot;http://www.springframework.org/schema/beansquot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xsi:schemaLocation=quot;...quot;> <bean id=quot;clinicquot; class=quot;org.springframework.samples.petclinic.JdbcClinicquot;> <constructor-arg ref=quot;dataSourcequot;/> </bean> </beans> 4 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 5. Spring 2.0 schema support <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <beans xmlns=quot;http://www.springframework.org/schema/beansquot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:tx=quot;http://www.springframework.org/schema/txquot; xsi:schemaLocation=quot;...quot;> <tx:annotation-driven base-package=quot;org.springframework.samples.petclinicquot;/> </beans> 5 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 6. Spring 2.5 annotations @Transactional @Repository public class HibernateClinic implements Clinic { private SessionFactory sessionFactory; @Autowired public HibernateClinic( SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } } 6 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 7. Component scanning <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <beans xmlns=quot;http://www.springframework.org/schema/beansquot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:context=quot;http://www.springframework.org/schema/contextquot; xsi:schemaLocation=quot;...quot;> <context:component-scan base-package=quot;org.springframework.samples.petclinicquot;/> </beans> 7 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 8. @Controller for Spring MVC @Controller public class ClinicController { private final Clinic clinic; @Autowired public ClinicController(Clinic clinic) { this.clinic = clinic; } ... } 8 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 9. @RequestMapping methods @Controller public class ClinicController { ... @RequestMapping(quot;/vetsquot;) public List<Vet> vets() { return clinic.getVets(); } } 9 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 10. Constantly simplifying • LoC for sample application PetClinic over time Spring 2.0 Spring 2.5 10 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 11. Spring as a foundation • Other technologies building on the Spring foundation •Spring Batch 2.0 (e.g. with @BatchComponent) •Spring Integration 1.0 (e.g. with @MessageEndpoint) •Spring Web Services (e.g. with @Endpoint) •... • Most projects feature annotation-based options as well as XML-based ones 11 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 12. Other portfolio example: Spring Integration 1.0 - dec08 • Relatively new project under the Spring Portfolio umbrella • Focuses on in-VM lightweight integration scenarios –asynchronous messaging in a single VM –with adapters for many formats to integrate with external systems (JMS, Email, File, et cetera) • Implement of the Patterns of Enterprise Application Integration (Hohpe et. al.) 12 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 13. @MessageEndpoint @MessageEndpoint public class OrderSplitter { @Splitter(inputChannel=quot;ordersquot;, outputChannel=quot;drinksquot;) public List<OrderItem> split(Order order) { return order.getItems(); } } 13 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 14. @MessageEndpoint <si:splitter input-channel=quot;ordersquot; output-channel=quot;drinksquot; ref=quot;orderSplitterquot; method=quot;splitquot; /> <bean id=quot;orderSplitterquot; class=quot;org.sfw.integration..xml.OrderSplitterquot;/> Look ma, no annotations! public class OrderSplitter { public List<OrderItem> split(Order order) { return order.getItems(); } } 14 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 15. New in Spring 3.0 • Previously available in a separate project (Spring JavaConfig) • Has been available in prototype form since early 2005 • Now promoted to the core Spring Framework 15 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 16. Spring 1.0 <beans/> schema <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <beans xmlns=quot;http://www.springframework.org/schema/beansquot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xsi:schemaLocation=quot;...quot;> <bean id=quot;clinicquot; class=quot;org.springframework.samples.petclinic.JdbcClinicquot;> <constructor-arg ref=quot;dataSourcequot;/> </bean> </beans> 16 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 17. JavaConfig in Action @Configuration public abstract class MyConfig { @Bean public Clinic clinic() { DataSource ds = dataSource(); return new JdbcClinic(ds); } One method per bean @Autowired public abstract DataSource dataSource(); } 17 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 18. Agenda • Configuration options in 1.0, 2.0, 2.5 and 3.0 • Introduction of REST support in Spring MVC • Migration of OXM from WS to Spring Framework • Introduction of expression language support • Other features and considerations for Spring 3.0 18 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 19. Summary of REST • (Ideally) stateless server architecture • Resources • Actions / operations on those resources • Representations 19 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 20. A practical example • http://bank.com/account/1234 • Represents the account resources –GET retrieves the account •GET to bank.com/account/1234 to retrieve –PUT creates or modifies a resource •Post to bank.com/account/1234 to create/update –POST creates a resource •Post to bank.com/account to create a new account –DELETE deletes a resources •DELETE to bank.com/account/1234 to delete or for example deactiveate / cancel 20 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 21. Summary of Spring REST • URI template support (client & controller) • Support for representations (HTML, XML, RSS, Atom, PDF, Excel, JSON) • Servlet Filter to PUT/DELETE support • Built on Spring MVC 21 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 22. Support for URI templates @Controller @RequestMapping(quot;/account/*quot;) public class AccountController { @RequestMapping(value=quot;/*/{id}quot;, method=RequestMethod.GET) public Account get(@PathVariable long id) { // retrieve and return account } } Handles URL: http://bank.com/account/1234 22 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 23. Representations • Neatly laid-out support for several representations of your data: –HTML (e.g. through FreeMarker or JSPs) –PDF and Excel (POI, JExcelApi, iText) –JSON, RSS, Atom –XML • Support for changing the representation based on extension or the accept-header 23 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 24. Support for PUT and DELETE • Most browsers don’t support PUT / DELETE • So what about the following: @RequestMapping(value=quot;/*/{id}quot;, method=RequestMethod.DELETE) public void delete(@PathVariable long id) { // delete account } 24 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 25. Support for PUT and DELETE • Most browsers don’t support PUT / DELETE • So what about the following: @RequestMapping(value=quot;/*/{id}quot;, method=RequestMethod.DELETE) public void delete(@PathVariable long id) { // delete account } • Support for PUT and DELETE is added through a special ServletFilter (and in HTML for example using a hidden input field) 25 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 26. Agenda • Recap of Spring 2.5 configuration options and @MVC • Introduction of REST support in Spring MVC • Migration of OXM to Spring Framework • Introduction of expression language support • Other features and considerations for Spring 3.0 26 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 27. Object-XML mapping abstraction in Spring • Mapping objects to XML and vice versa through –XmlBeans, JiBX, Castor, JAXB (2), XStream • Used to be part of Spring WS • Useful for REST purposes as well • Moved to core Spring Framework as of 3.0 27 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 28. Interfaces for marshalling and unmarshalling public interface Marshaller { public void marshal(Object graph, Result result) throws XmlMappingException, IOException; } public interface Unmarshaller { public Object unmarshal(Source source) throws XmlMappingException, IOException; } 28 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 29. Usages throughout portfolio • JMS (MarshallingMessageConverter • MVC (MarshallingView) • Batch • ... 29 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 30. Agenda • Recap of Spring 2.5 configuration options and @MVC • Introduction of REST support in Spring MVC • Migration of OXM from WS to Spring Framework • Introduction of expression language support • Other features and considerations for Spring 3.0 30 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 31. Property externalization in 2.5 • Traditionally using <bean id=quot;dataSourcequot; class=quot;org.apache.commons.dbcp.BasicDataSourcequot; destroy-method=quot;closequot;> <property name=quot;driverClassNamequot; value=quot;${driver}quot;/> <property name=quot;urlquot; value=quot;${url}quot;/> <property name=quot;usernanequot; value=quot;${username}quot;/> <property name=quot;passwordquot; value=quot;${passwordquot;/> </bean> <context:property-placeholder location=quot;/WEB-INF/jdbc.propertiesquot;/> 31 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 32. Drawbacks of this approach • It only supports properties • The replacement is done at initialization time »Not at bean creation time • It doesn’t support conditionals or other constructs • It’s not very extensible for other frameworks 32 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 33. Introducing expressions • Spring 3.0 will include full support for the unified expression language • The replacement is done when the bean is created (and not when reading the configuration) 33 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 34. Introducing expressions • Spring 3.0 will include full support for the unified expression language • The replacement is done when the bean is created (and not when reading the configuration) <bean id=quot;dataSourcequot; class=quot;org.apache.commons.dbcp.BasicDataSourcequot; destroy-method=quot;closequot; scope=”prototype”> ... <property name=quot;urlquot; value=quot;${systemProperties.url}quot;/> </bean> 34 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 35. Using expressions in other parts of the portfolio • An extensible expression language • Will be used by other frameworks –Security (example below) –Integration / JMS (e.g. dynamic queue names) –Et cetera @PreAuthorize(quot;hasRole('ROLE_SUPERVISOR') or quot; + quot;hasRole('ROLE_TELLER') and quot; + quot;(#account.balance + #amount >= -#account.overdraft)quot; ) public void post(Account account, double amount); 35 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 36. Agenda • Recap of Spring 2.5 configuration options and @MVC • Introduction of REST support in Spring MVC • Migration of OXM from WS to Spring Framework • Introduction of expression language support • Other features and considerations for Spring 3.0 36 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 37. Backwards compatibility • Spring 3.0 will deprecate / remove various things •Traditional Spring MVC controller hierarchy (??) •Commons Attributes support •Traditional TopLink support •Traditional JUnit 3.8 class hierarchy • 95% backwards compatible with regards to APIs • 99% backwards compatible in the programming model 37 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 38. Roadmap • Spring 3.0 M1 released in December • Spring 3.0 M2 to be released any time now • Further Milestones later this quarter • Spring 3.0 RC and release Q2 2009 • More information on what features are included in which milestones: http://jira.springframework.org 38 Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 39. Questions? Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.