SlideShare a Scribd company logo
1 of 34
Spring Framework 3.0
                                                 The Next Generation


                                                                          Jürgen Höller
                                                       VP & Distinguished Engineer
                                                              SpringSource




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


         • Quick Review: Spring 2.5
         • Spring 3.0 Themes and Features
         • Spring 3.0 Roadmap




Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   2
Spring Framework 2.5


         • Comprehensive support for
           annotation-based configuration
                   – @Autowired
                              • with optional @Qualifier or custom qualifier
                   – @Transactional
                   – @Service, @Repository, @Controller
         • Common Java EE 5 annotations supported too
                   –      @PostConstruct, @PreDestroy
                   –      @PersistenceContext, @PersistenceUnit
                   –      @Resource, @EJB, @WebServiceRef
                   –      @TransactionAttribute


Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   3
Annotated Bean Component

         @Service
         public class RewardNetworkService
               implements RewardNetwork {

               @Autowired
               public RewardNetworkService(AccountRepository ar) {
                 …
               }

               @Transactional
               public RewardConfirmation rewardAccountFor(Dining d) {
                 …
               }
         }


Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   4
Minimal XML Bean Definitions


   <!– Activating annotation-based configuration -->

   <context:annotation-config/>

   <bean class=”com.myapp.rewards.RewardNetworkImpl”/>

   <bean class=”com.myapp.rewards.JdbcAccountRepository”/>


   <!– Plus shared infrastructure configuration beans:
      PlatformTransactionManager, DataSource, etc -->




Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   5
Test Context Framework

         @RunWith(SpringJUnit4ClassRunner.class)
         @ContextConfiguration
         public class RewardSystemIntegrationTests {

               @Autowired
               private RewardNetwork rewardNetwork;

               @Test
               @Transactional
               public void testRewardAccountForDining() {
                 // test in transaction with auto-rollback
               }
         }



Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   6
@MVC Controller Style

         @Controller
         public class MyController {

               private final MyService myService;

               @Autowired
               public MyController(MyService myService) {
                 this.myService = myService;
               }

               @RequestMapping("/removeBook")
               public String removeBook(@RequestParam("book") String bookId) {
                 this.myService.deleteBook(bookId);
                 return "redirect:myBooks";
               }
         }


Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   7
Spring 3.0 Themes


         • Java 5+ foundation
                   – even stronger support for annotated components
         • Spring Expression Language
                   – Unified EL++
         • Comprehensive REST support
                   – and other Spring @MVC additions
         • Declarative model validation
                   – Hibernate Validator, JSR 303
         • Support for Portlet 2.0
                   – action/event/resource request mappings
         • Early support for Java EE 6
                   – JSF 2.0, JPA 2.0, etc



Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   8
New Project Layout


         • Framework modules revised
                   – now managed in Maven style
                   – one source tree per module jar
                              • spring-beans.jar, spring-aop.jar, etc
                   – no spring.jar anymore!
         • Built with new Spring build system as known
           from Spring Web Flow 2.0
                   –      Ivy-based "Spring Build" system
                   –      consistent deployment procedure
                   –      consistent dependency management
                   –      consistent generation of OSGi manifests


Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   9
Core APIs updated for Java 5


         • BeanFactory interface returns typed bean
           instances as far as possible
                   – T getBean(String name, Class<T> requiredType)
                   – Map<String, T> getBeansOfType(Class<T> type)
         • Spring's TaskExecutor interface extends
           java.util.concurrent.Executor now
                   – extended AsyncTaskExecutor supports standard
                     Callables with Futures
         • Typed ApplicationListener<E>
                   – ApplicationEventMulticaster detects declared event
                     type and filters accordingly


Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   10
Portfolio Rearrangements


         • Spring 3.0 includes a revised version of the
           Object/XML Mapping (OXM) module
                   – known from Spring Web Services
                   – supported for REST-style payload conversion
                   – also useful e.g. for SQL XML access
         • Spring 3.0 features a revised binding and
           type conversion infrastructure
                   – including the capabilities of Spring Web Flow's binding
                   – stateless Java 5+ type converters with EL integration
                   – superseding standard JDK PropertyEditors




Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   11
Annotated Factory Methods


         • Spring 3.0 includes the core functionality of the
           Spring JavaConfig project
                   – configuration classes defining managed beans
                   – common handling of annotated factory methods


         @Bean @Primary @Lazy
         public RewardsService rewardsService() {
           RewardsServiceImpl service = new RewardsServiceImpl();
           service.setDataSource(…);
           return service;
         }


Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   12
Use of Meta-Annotations


         • More powerful options for custom annotations
                   – combining meta-annotations e.g. on stereotype
                   – automatically detected (no configuration necessary!)


         @Service
         @Scope("request")
         @Transactional(rollbackFor=Exception.class)
         @Retention(RetentionPolicy.RUNTIME)
         public @interface MyService {}

         @MyService
         public class RewardsService {
           …
         }

Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   13
EL in Bean Definitions


         <bean class="mycompany.RewardsTestDatabase">

               <property name="databaseName"
                   value="“#{systemProperties.databaseName}”/>

               <property name="keyGenerator"
                   value="“#{strategyBean.databaseKeyGenerator}”/>

         </bean>




Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   14
EL in Component Annotations


         @Repository
         public class RewardsTestDatabase {

               @Value(“#{systemProperties.databaseName}”)
               public void setDatabaseName(String dbName) { … }

               @Value(“#{strategyBean.databaseKeyGenerator}”)
               public void setKeyGenerator(KeyGenerator kg) { … }
         }




Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   15
Powerful Spring EL Parser


         • Custom expression parser implementation
           shipped as part of Spring 3.0
                   – package org.springframework.expression
                   – next-generation expression engine
                              • inspired by Spring Web Flow 2.0's expression support
                   – pluggable and customizable
         • Compatible with Unified EL but significantly
           more powerful
                   – navigating bean properties, maps, etc
                   – method invocations
                   – construction of value objects


Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   16
EL Context Attributes


         • Example showed access to EL attributes
                   – "systemProperties", "strategyBean"
                   – implicit references in expressions
         • Implicit attributes to be exposed by default,
           depending on runtime context
                   – e.g. "systemProperties", "systemEnvironment"
                              • global platform context
                   – access to all Spring-defined beans by name
                              • similar to managed beans in JSF expressions
                   – extensible through Scope SPI
                              • e.g. for step scope in Spring Batch



Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   17
Web Context Attributes


         • Implicit web-specific attributes to be
           exposed by default as well
                   –      "contextParameters": web.xml init-params
                   –      "contextAttributes": ServletContext attributes
                   –      "request": current Servlet/PortletRequest
                   –      "session": current Http/PortletSession
         • Exposure of all implicit JSF objects when
           running within a JSF request context
                   – "param", "initParam", "facesContext", etc
                   – full compatibility with JSF managed bean facility




Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   18
REST Support


         • Spring MVC to provide first-class support for
           REST-style mappings
                   – extraction of URI template parameters
                   – content negotiation in view resolver
         • Goal: native REST support within Spring
           MVC, for UI as well as non-UI usage
                   – in natural MVC style
         • Alternative: using JAX-RS through integrated
           JAX-RS provider (e.g. Jersey)
                   – using the JAX-RS component model to build
                     programmatic resource endpoints




Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
REST in MVC - @PathVariable


           http://rewarddining.com/rewards/12345
         @RequestMapping(value = "/rewards/{id}", method = GET)
         public Reward reward(@PathVariable("id") long id) {
           return this.rewardsAdminService.findReward(id);
         }




Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   20
Different Representations


         • JSON
                   GET http://rewarddining.com/accounts/1 accepts application/json
                   GET http://rewarddining.com/accounts/1.json


         • XML
                   GET http://rewarddining.com/accounts/1 accepts application/xml
                   GET http://rewarddining.com/accounts/1.xml


         • ATOM
                  GET http://rewarddining.com/accounts/1 accepts application/atom+xml
                  GET http://rewarddining.com/accounts/1.atom



Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   21
Common @MVC Refinements


         • More options for handler method parameters
                   –      in addition to @RequestParam and @PathVariable
                   –      @RequestHeader: access to request headers
                   –      @CookieValue: HTTP cookie access
                   –      supported for Servlet MVC and Portlet MVC


         @RequestMapping("/show")
         public Reward show(@RequestHeader("region") long regionId,
               @CookieValue("language") String langId) {
           ...
         }


Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   22
Portlet 2.0 Support


         • Portlet 2.0: major new capabilities
                   –      explicit action name concept for dispatching
                   –      resource requests for servlet-style serving
                   –      events for inter-portlet communication
                   –      portlet filters analogous to servlet filters
         • Spring's Portlet MVC 3.0 to support explicit
           mapping annotations
                   – @ActionMapping, @RenderMapping,
                     @ResourceMapping, @EventMapping
                   – specializations of Spring's @RequestMapping
                              • supporting action names, window states, etc



Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   23
Spring Portlet MVC 3.0

         @Controller
         @RequestMapping("EDIT")
         public class MyPortletController {
           …

               @ActionMapping("delete")
               public void removeBook(@RequestParam("book") String bookId) {
                 this.myService.deleteBook(bookId);
               }

               @EventMapping("BookUpdate")
               public void updateBook(BookUpdateEvent bookUpdate) {
                 // extract book entity data from event payload object
                 this.myService.updateBook(…);
               }
         }


Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   24
Model Validation

         public class Reward {
           @NotNull
           @Past
           private Date transactionDate;
         }

         In view:
         <form:input path="transactionDate">

         • Same metadata can be used for persisting, rendering, etc
         • Spring 3.0 RC1: to be supported for MVC data binding
         • JSR-303 "Bean Validation" as the common ground



Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   25
Scoped Bean Serializability


         • Problem with Spring 2.5: serializability of
           session and conversation objects
                   – when referencing shared service objects via Spring
                     dependency injection
                              • and not marking them as transient
                   – typical situation: scoped bean instance holds on to
                     DataSource or the like
                              • DataSource reference is not serializable
                              • -> whole bean not serializable
         • Solution: proxies that reobtain references
           on deserialization
                   – from current Spring WebApplicationContext


Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   26
Scheduling Enhancements


         • Spring 3.0 introduces a major overhaul of
           the scheduling package
                   – extended java.util.concurrent support
                              • prepared for JSR-236 "Concurrency Utilities for Java EE"
                   – TaskScheduler interface with Triggers
                              • including cron expression triggers
                   – @Async annotation for asynchronous user methods
                              • @Scheduled for cron-triggered methods
         • XML scheduling namespace
                   – cron expressions with method references
                   – convenient executor service setup



Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   27
Spring 3.0 and Java EE 6


         • Early Java EE 6 API support in Spring 3.0
                   – integration with JSF 2.0
                              • full compatibility as managed bean facility
                   – integration with JPA 2.0
                              • support for lock modes, query timeouts, etc
                   – support for JSR-303 Bean Validation annotations
                              • through Hibernate Validator 4.0 integration
                   – all embeddable on Tomcat 5.5+ / J2EE 1.4+
         • Spring 3.x: support for Java EE 6 platforms
                   – Servlet 3.0 (waiting for GlassFish 3 and Tomcat 7)
                   – JSR-236 "Concurrency Utilities for Java EE"



Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   28
Spring 3.0 Platform Support


         • Requires Java 5 or above
                   – Java 6 automatically detected & supported
         • Web container: Servlet 2.4 or above
                   – e.g. Tomcat 5.5 & 6.0
         • Java EE level: J2EE 1.4 or above
                   – e.g. WebSphere 6.1 & 7.0
         • Fully OSGi compatible out of the box
                   – featured in dm Server 2.0
         • Also compatible with Google App Engine
                   – and other 'special' hosting environments



Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   29
Pruning & Deprecation in 3.0


         • Some pruning: removal of outdated features
                   – Commons Attributes support
                              • superseded by Java 5 annotations
                   – traditional TopLink API support
                              • in favor of JPA (EclipseLink)
                   – subclass-style Struts 1.x support
         • Some deprecation: superseded features
                   – traditional MVC form controller hierarchy
                              • superseded by annotated controller style
                   – traditional JUnit 3.8 test class hierarchy
                              • superseded by test context framework
                   – several outdated helper classes



Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   30
Spring 2.5 Mission Continued


         • Spring 3 continues Spring 2.5's mission
                   – fully embracing Java 5 in the core Spring
                     programming and configuration model
                   – now with even the core framework requiring Java 5
                              • all framework classes using Java 5 language syntax
         • Backwards compatibility with Spring 2.5
                   – 100% compatibility of programming model
                   – 95% compatibility of extension points
                   – all previously deprecated API to be removed
                              • Make sure you're not using outdated Spring 1.2 / 2.0
                                API anymore!




Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   31
Spring 3.0 Summary


         • Spring 3.0 embraces REST and EL
                   – full-scale REST support
                   – broad Unified EL++ support in the core
         • Spring 3.0 significantly extends and refines
           annotated web controllers
                   – RESTful URI mappings
                   – annotation-based model validation
         • Spring 3.0 remains backwards compatible
           with Spring 2.5 on Java 5+
                   – enabling a smooth migration path



Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   32
Spring 3.0 Roadmap


         • Spring Framework 3.0 M3 to be released
           any day now
                   – last milestone before RC1
         • Spring Framework 3.0 RC1 scheduled for
           late May 2009
                   – GA to follow soon after
         • Spring Framework 3.1 expected in
           Q4 2009
                   – full compatibility with Java EE 6 platforms
                   – first-class support for conversation management



Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   33
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   34

More Related Content

What's hot

Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010
Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010
Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010Arun Gupta
 
Understanding
Understanding Understanding
Understanding Arun Gupta
 
TDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the CloudTDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the CloudArun Gupta
 
JavaOne India 2011 - Servlets 3.0
JavaOne India 2011 - Servlets 3.0JavaOne India 2011 - Servlets 3.0
JavaOne India 2011 - Servlets 3.0Arun Gupta
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureArun Gupta
 
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.0Arun Gupta
 
Annotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCAnnotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCJohn Lewis
 
Web Technologies in Java EE 7
Web Technologies in Java EE 7Web Technologies in Java EE 7
Web Technologies in Java EE 7Lukáš Fryč
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVCDzmitry Naskou
 
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Skills Matter
 
Java EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUGJava EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUGArun Gupta
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVCJohn Lewis
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with SpringJoshua Long
 
Introduction to java servlet 3.0 api javaone 2008
Introduction to java servlet 3.0 api javaone 2008Introduction to java servlet 3.0 api javaone 2008
Introduction to java servlet 3.0 api javaone 2008JavaEE Trainers
 
F428435966 odtug web-logic for developers
F428435966 odtug   web-logic for developersF428435966 odtug   web-logic for developers
F428435966 odtug web-logic for developersMeng He
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with SpringJoshua Long
 

What's hot (18)

Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010
Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010
Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010
 
Understanding
Understanding Understanding
Understanding
 
TDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the CloudTDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the Cloud
 
JavaOne India 2011 - Servlets 3.0
JavaOne India 2011 - Servlets 3.0JavaOne India 2011 - Servlets 3.0
JavaOne India 2011 - Servlets 3.0
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for future
 
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
 
Spring WebApplication development
Spring WebApplication developmentSpring WebApplication development
Spring WebApplication development
 
Annotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCAnnotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVC
 
Web Technologies in Java EE 7
Web Technologies in Java EE 7Web Technologies in Java EE 7
Web Technologies in Java EE 7
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
 
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
 
Java EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUGJava EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUG
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVC
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with Spring
 
Introduction to java servlet 3.0 api javaone 2008
Introduction to java servlet 3.0 api javaone 2008Introduction to java servlet 3.0 api javaone 2008
Introduction to java servlet 3.0 api javaone 2008
 
F428435966 odtug web-logic for developers
F428435966 odtug   web-logic for developersF428435966 odtug   web-logic for developers
F428435966 odtug web-logic for developers
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with Spring
 

Viewers also liked

Galaxy S II: samsung publica una guía para la actualización a Android ICS
Galaxy S II: samsung publica una guía para la actualización a Android ICSGalaxy S II: samsung publica una guía para la actualización a Android ICS
Galaxy S II: samsung publica una guía para la actualización a Android ICSDavid Motta Baldarrago
 
El Rol de un Arquitecto de Software
El Rol de un Arquitecto de SoftwareEl Rol de un Arquitecto de Software
El Rol de un Arquitecto de SoftwareSorey García
 
Modelo Del Negocio con RUP y UML Parte 3
Modelo Del Negocio con RUP y UML Parte 3Modelo Del Negocio con RUP y UML Parte 3
Modelo Del Negocio con RUP y UML Parte 3David Motta Baldarrago
 

Viewers also liked (6)

Galaxy S II: samsung publica una guía para la actualización a Android ICS
Galaxy S II: samsung publica una guía para la actualización a Android ICSGalaxy S II: samsung publica una guía para la actualización a Android ICS
Galaxy S II: samsung publica una guía para la actualización a Android ICS
 
Simple Jdbc With Spring 2.5
Simple Jdbc With Spring 2.5Simple Jdbc With Spring 2.5
Simple Jdbc With Spring 2.5
 
Android web services - Spring Android
Android web services - Spring AndroidAndroid web services - Spring Android
Android web services - Spring Android
 
Los mejores trucos de Asterisk
Los mejores trucos de AsteriskLos mejores trucos de Asterisk
Los mejores trucos de Asterisk
 
El Rol de un Arquitecto de Software
El Rol de un Arquitecto de SoftwareEl Rol de un Arquitecto de Software
El Rol de un Arquitecto de Software
 
Modelo Del Negocio con RUP y UML Parte 3
Modelo Del Negocio con RUP y UML Parte 3Modelo Del Negocio con RUP y UML Parte 3
Modelo Del Negocio con RUP y UML Parte 3
 

Similar to Lo nuevo en Spring 3.0

Spring 3.1: a Walking Tour
Spring 3.1: a Walking TourSpring 3.1: a Walking Tour
Spring 3.1: a Walking TourJoshua Long
 
Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011Sam Brannen
 
Spring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Spring 3.1 in a Nutshell | Sam BrannenSpring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Spring 3.1 in a Nutshell | Sam BrannenJAX London
 
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012Sam Brannen
 
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnitionJava EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnitionArun Gupta
 
Java EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerJava EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerArun Gupta
 
Spring 3.1 in a Nutshell
Spring 3.1 in a NutshellSpring 3.1 in a Nutshell
Spring 3.1 in a NutshellSam Brannen
 
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingSpring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingThorsten Kamann
 
A Walking Tour of (almost) all of Springdom
A Walking Tour of (almost) all of Springdom A Walking Tour of (almost) all of Springdom
A Walking Tour of (almost) all of Springdom Joshua Long
 
Developing Agile Java Applications using Spring tools
Developing Agile Java Applications using Spring toolsDeveloping Agile Java Applications using Spring tools
Developing Agile Java Applications using Spring toolsSathish Chittibabu
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework Serhat Can
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Rohit Kelapure
 
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...Arun Gupta
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC frameworkMohit Gupta
 
What's New in Spring 3.0
What's New in Spring 3.0What's New in Spring 3.0
What's New in Spring 3.0Sam Brannen
 
Java spring framework
Java spring frameworkJava spring framework
Java spring frameworkRajiv Gupta
 
Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6Arun Gupta
 
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
 

Similar to Lo nuevo en Spring 3.0 (20)

Spring 3.1: a Walking Tour
Spring 3.1: a Walking TourSpring 3.1: a Walking Tour
Spring 3.1: a Walking Tour
 
Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011
 
Spring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Spring 3.1 in a Nutshell | Sam BrannenSpring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Spring 3.1 in a Nutshell | Sam Brannen
 
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
 
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnitionJava EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnition
 
Java EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerJava EE 6 = Less Code + More Power
Java EE 6 = Less Code + More Power
 
Spring 3.1 in a Nutshell
Spring 3.1 in a NutshellSpring 3.1 in a Nutshell
Spring 3.1 in a Nutshell
 
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingSpring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
 
Spring introduction
Spring introductionSpring introduction
Spring introduction
 
A Walking Tour of (almost) all of Springdom
A Walking Tour of (almost) all of Springdom A Walking Tour of (almost) all of Springdom
A Walking Tour of (almost) all of Springdom
 
Developing Agile Java Applications using Spring tools
Developing Agile Java Applications using Spring toolsDeveloping Agile Java Applications using Spring tools
Developing Agile Java Applications using Spring tools
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010
 
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC framework
 
What's New in Spring 3.0
What's New in Spring 3.0What's New in Spring 3.0
What's New in Spring 3.0
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Java spring framework
Java spring frameworkJava spring framework
Java spring framework
 
Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6
 
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
 

More from David Motta Baldarrago

More from David Motta Baldarrago (10)

Repositorio SVN Google Code
Repositorio SVN Google CodeRepositorio SVN Google Code
Repositorio SVN Google Code
 
Diseño Agil con TDD
Diseño Agil con TDDDiseño Agil con TDD
Diseño Agil con TDD
 
Scjp Sun Certified Programmer For Java 6 Exam 310 065
Scjp Sun Certified Programmer For Java 6 Exam 310 065Scjp Sun Certified Programmer For Java 6 Exam 310 065
Scjp Sun Certified Programmer For Java 6 Exam 310 065
 
Modelo Del Negocio con RUP y UML Parte 2
Modelo Del Negocio con RUP y UML Parte 2Modelo Del Negocio con RUP y UML Parte 2
Modelo Del Negocio con RUP y UML Parte 2
 
Modelo Del Negocio con RUP y UML Parte 1
Modelo Del Negocio con RUP y UML Parte 1Modelo Del Negocio con RUP y UML Parte 1
Modelo Del Negocio con RUP y UML Parte 1
 
Documentacion De Los Procesos
Documentacion De Los ProcesosDocumentacion De Los Procesos
Documentacion De Los Procesos
 
Upgrade Zaptel to DAHDI
Upgrade Zaptel to DAHDIUpgrade Zaptel to DAHDI
Upgrade Zaptel to DAHDI
 
Instalacion de Elastix
Instalacion de ElastixInstalacion de Elastix
Instalacion de Elastix
 
Elastix Without Tears
Elastix Without TearsElastix Without Tears
Elastix Without Tears
 
Instalacion Debian + Asterisk + FreePbx + A2Billing
Instalacion Debian + Asterisk + FreePbx + A2BillingInstalacion Debian + Asterisk + FreePbx + A2Billing
Instalacion Debian + Asterisk + FreePbx + A2Billing
 

Recently uploaded

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 

Recently uploaded (20)

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 

Lo nuevo en Spring 3.0

  • 1. Spring Framework 3.0 The Next Generation Jürgen Höller VP & Distinguished Engineer SpringSource Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 2. Agenda • Quick Review: Spring 2.5 • Spring 3.0 Themes and Features • Spring 3.0 Roadmap Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 2
  • 3. Spring Framework 2.5 • Comprehensive support for annotation-based configuration – @Autowired • with optional @Qualifier or custom qualifier – @Transactional – @Service, @Repository, @Controller • Common Java EE 5 annotations supported too – @PostConstruct, @PreDestroy – @PersistenceContext, @PersistenceUnit – @Resource, @EJB, @WebServiceRef – @TransactionAttribute Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 3
  • 4. Annotated Bean Component @Service public class RewardNetworkService implements RewardNetwork { @Autowired public RewardNetworkService(AccountRepository ar) { … } @Transactional public RewardConfirmation rewardAccountFor(Dining d) { … } } Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 4
  • 5. Minimal XML Bean Definitions <!– Activating annotation-based configuration --> <context:annotation-config/> <bean class=”com.myapp.rewards.RewardNetworkImpl”/> <bean class=”com.myapp.rewards.JdbcAccountRepository”/> <!– Plus shared infrastructure configuration beans: PlatformTransactionManager, DataSource, etc --> Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 5
  • 6. Test Context Framework @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration public class RewardSystemIntegrationTests { @Autowired private RewardNetwork rewardNetwork; @Test @Transactional public void testRewardAccountForDining() { // test in transaction with auto-rollback } } Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 6
  • 7. @MVC Controller Style @Controller public class MyController { private final MyService myService; @Autowired public MyController(MyService myService) { this.myService = myService; } @RequestMapping("/removeBook") public String removeBook(@RequestParam("book") String bookId) { this.myService.deleteBook(bookId); return "redirect:myBooks"; } } Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 7
  • 8. Spring 3.0 Themes • Java 5+ foundation – even stronger support for annotated components • Spring Expression Language – Unified EL++ • Comprehensive REST support – and other Spring @MVC additions • Declarative model validation – Hibernate Validator, JSR 303 • Support for Portlet 2.0 – action/event/resource request mappings • Early support for Java EE 6 – JSF 2.0, JPA 2.0, etc Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 8
  • 9. New Project Layout • Framework modules revised – now managed in Maven style – one source tree per module jar • spring-beans.jar, spring-aop.jar, etc – no spring.jar anymore! • Built with new Spring build system as known from Spring Web Flow 2.0 – Ivy-based "Spring Build" system – consistent deployment procedure – consistent dependency management – consistent generation of OSGi manifests Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 9
  • 10. Core APIs updated for Java 5 • BeanFactory interface returns typed bean instances as far as possible – T getBean(String name, Class<T> requiredType) – Map<String, T> getBeansOfType(Class<T> type) • Spring's TaskExecutor interface extends java.util.concurrent.Executor now – extended AsyncTaskExecutor supports standard Callables with Futures • Typed ApplicationListener<E> – ApplicationEventMulticaster detects declared event type and filters accordingly Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 10
  • 11. Portfolio Rearrangements • Spring 3.0 includes a revised version of the Object/XML Mapping (OXM) module – known from Spring Web Services – supported for REST-style payload conversion – also useful e.g. for SQL XML access • Spring 3.0 features a revised binding and type conversion infrastructure – including the capabilities of Spring Web Flow's binding – stateless Java 5+ type converters with EL integration – superseding standard JDK PropertyEditors Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 11
  • 12. Annotated Factory Methods • Spring 3.0 includes the core functionality of the Spring JavaConfig project – configuration classes defining managed beans – common handling of annotated factory methods @Bean @Primary @Lazy public RewardsService rewardsService() { RewardsServiceImpl service = new RewardsServiceImpl(); service.setDataSource(…); return service; } Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 12
  • 13. Use of Meta-Annotations • More powerful options for custom annotations – combining meta-annotations e.g. on stereotype – automatically detected (no configuration necessary!) @Service @Scope("request") @Transactional(rollbackFor=Exception.class) @Retention(RetentionPolicy.RUNTIME) public @interface MyService {} @MyService public class RewardsService { … } Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 13
  • 14. EL in Bean Definitions <bean class="mycompany.RewardsTestDatabase"> <property name="databaseName" value="“#{systemProperties.databaseName}”/> <property name="keyGenerator" value="“#{strategyBean.databaseKeyGenerator}”/> </bean> Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 14
  • 15. EL in Component Annotations @Repository public class RewardsTestDatabase { @Value(“#{systemProperties.databaseName}”) public void setDatabaseName(String dbName) { … } @Value(“#{strategyBean.databaseKeyGenerator}”) public void setKeyGenerator(KeyGenerator kg) { … } } Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 15
  • 16. Powerful Spring EL Parser • Custom expression parser implementation shipped as part of Spring 3.0 – package org.springframework.expression – next-generation expression engine • inspired by Spring Web Flow 2.0's expression support – pluggable and customizable • Compatible with Unified EL but significantly more powerful – navigating bean properties, maps, etc – method invocations – construction of value objects Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 16
  • 17. EL Context Attributes • Example showed access to EL attributes – "systemProperties", "strategyBean" – implicit references in expressions • Implicit attributes to be exposed by default, depending on runtime context – e.g. "systemProperties", "systemEnvironment" • global platform context – access to all Spring-defined beans by name • similar to managed beans in JSF expressions – extensible through Scope SPI • e.g. for step scope in Spring Batch Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 17
  • 18. Web Context Attributes • Implicit web-specific attributes to be exposed by default as well – "contextParameters": web.xml init-params – "contextAttributes": ServletContext attributes – "request": current Servlet/PortletRequest – "session": current Http/PortletSession • Exposure of all implicit JSF objects when running within a JSF request context – "param", "initParam", "facesContext", etc – full compatibility with JSF managed bean facility Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 18
  • 19. REST Support • Spring MVC to provide first-class support for REST-style mappings – extraction of URI template parameters – content negotiation in view resolver • Goal: native REST support within Spring MVC, for UI as well as non-UI usage – in natural MVC style • Alternative: using JAX-RS through integrated JAX-RS provider (e.g. Jersey) – using the JAX-RS component model to build programmatic resource endpoints Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19
  • 20. REST in MVC - @PathVariable http://rewarddining.com/rewards/12345 @RequestMapping(value = "/rewards/{id}", method = GET) public Reward reward(@PathVariable("id") long id) { return this.rewardsAdminService.findReward(id); } Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 20
  • 21. Different Representations • JSON GET http://rewarddining.com/accounts/1 accepts application/json GET http://rewarddining.com/accounts/1.json • XML GET http://rewarddining.com/accounts/1 accepts application/xml GET http://rewarddining.com/accounts/1.xml • ATOM GET http://rewarddining.com/accounts/1 accepts application/atom+xml GET http://rewarddining.com/accounts/1.atom Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 21
  • 22. Common @MVC Refinements • More options for handler method parameters – in addition to @RequestParam and @PathVariable – @RequestHeader: access to request headers – @CookieValue: HTTP cookie access – supported for Servlet MVC and Portlet MVC @RequestMapping("/show") public Reward show(@RequestHeader("region") long regionId, @CookieValue("language") String langId) { ... } Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 22
  • 23. Portlet 2.0 Support • Portlet 2.0: major new capabilities – explicit action name concept for dispatching – resource requests for servlet-style serving – events for inter-portlet communication – portlet filters analogous to servlet filters • Spring's Portlet MVC 3.0 to support explicit mapping annotations – @ActionMapping, @RenderMapping, @ResourceMapping, @EventMapping – specializations of Spring's @RequestMapping • supporting action names, window states, etc Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 23
  • 24. Spring Portlet MVC 3.0 @Controller @RequestMapping("EDIT") public class MyPortletController { … @ActionMapping("delete") public void removeBook(@RequestParam("book") String bookId) { this.myService.deleteBook(bookId); } @EventMapping("BookUpdate") public void updateBook(BookUpdateEvent bookUpdate) { // extract book entity data from event payload object this.myService.updateBook(…); } } Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 24
  • 25. Model Validation public class Reward { @NotNull @Past private Date transactionDate; } In view: <form:input path="transactionDate"> • Same metadata can be used for persisting, rendering, etc • Spring 3.0 RC1: to be supported for MVC data binding • JSR-303 "Bean Validation" as the common ground Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 25
  • 26. Scoped Bean Serializability • Problem with Spring 2.5: serializability of session and conversation objects – when referencing shared service objects via Spring dependency injection • and not marking them as transient – typical situation: scoped bean instance holds on to DataSource or the like • DataSource reference is not serializable • -> whole bean not serializable • Solution: proxies that reobtain references on deserialization – from current Spring WebApplicationContext Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 26
  • 27. Scheduling Enhancements • Spring 3.0 introduces a major overhaul of the scheduling package – extended java.util.concurrent support • prepared for JSR-236 "Concurrency Utilities for Java EE" – TaskScheduler interface with Triggers • including cron expression triggers – @Async annotation for asynchronous user methods • @Scheduled for cron-triggered methods • XML scheduling namespace – cron expressions with method references – convenient executor service setup Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 27
  • 28. Spring 3.0 and Java EE 6 • Early Java EE 6 API support in Spring 3.0 – integration with JSF 2.0 • full compatibility as managed bean facility – integration with JPA 2.0 • support for lock modes, query timeouts, etc – support for JSR-303 Bean Validation annotations • through Hibernate Validator 4.0 integration – all embeddable on Tomcat 5.5+ / J2EE 1.4+ • Spring 3.x: support for Java EE 6 platforms – Servlet 3.0 (waiting for GlassFish 3 and Tomcat 7) – JSR-236 "Concurrency Utilities for Java EE" Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 28
  • 29. Spring 3.0 Platform Support • Requires Java 5 or above – Java 6 automatically detected & supported • Web container: Servlet 2.4 or above – e.g. Tomcat 5.5 & 6.0 • Java EE level: J2EE 1.4 or above – e.g. WebSphere 6.1 & 7.0 • Fully OSGi compatible out of the box – featured in dm Server 2.0 • Also compatible with Google App Engine – and other 'special' hosting environments Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 29
  • 30. Pruning & Deprecation in 3.0 • Some pruning: removal of outdated features – Commons Attributes support • superseded by Java 5 annotations – traditional TopLink API support • in favor of JPA (EclipseLink) – subclass-style Struts 1.x support • Some deprecation: superseded features – traditional MVC form controller hierarchy • superseded by annotated controller style – traditional JUnit 3.8 test class hierarchy • superseded by test context framework – several outdated helper classes Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 30
  • 31. Spring 2.5 Mission Continued • Spring 3 continues Spring 2.5's mission – fully embracing Java 5 in the core Spring programming and configuration model – now with even the core framework requiring Java 5 • all framework classes using Java 5 language syntax • Backwards compatibility with Spring 2.5 – 100% compatibility of programming model – 95% compatibility of extension points – all previously deprecated API to be removed • Make sure you're not using outdated Spring 1.2 / 2.0 API anymore! Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 31
  • 32. Spring 3.0 Summary • Spring 3.0 embraces REST and EL – full-scale REST support – broad Unified EL++ support in the core • Spring 3.0 significantly extends and refines annotated web controllers – RESTful URI mappings – annotation-based model validation • Spring 3.0 remains backwards compatible with Spring 2.5 on Java 5+ – enabling a smooth migration path Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 32
  • 33. Spring 3.0 Roadmap • Spring Framework 3.0 M3 to be released any day now – last milestone before RC1 • Spring Framework 3.0 RC1 scheduled for late May 2009 – GA to follow soon after • Spring Framework 3.1 expected in Q4 2009 – full compatibility with Java EE 6 platforms – first-class support for conversation management Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 33
  • 34. Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 34