Documente Academic
Documente Profesional
Documente Cultură
0
The Next Generation
AGENDA
> Spring 3.0 Themes Java 5 REST ex pression language annot at ed web cont rollers > Spring 3.0 Roadmap
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
Spring's TaskExecutor interface ex tends java.util.concurrent.Ex ecutor now extended AsyncTaskEx ecutor supports standard Callables with Futures Typed ApplicationListener< E> ApplicationEventMulticaster detects declared event type and filters accordingly
>
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
@Bean @Primary @Lazy public RewardsService rewardsService() { RewardsServiceImpl service = new RewardsServiceImpl(); service.setDataSource(); return service; }
EL in Bean Definitions
<bean class="mycompany.RewardsTestDatabase"> <property name="databaseName" value="#{systemProperties.databaseName}/> <property name="keyGenerator" value="#{strategyBean.databaseKeyGenerator}/> </bean>
EL in Component Annotations
@Repository public class RewardsTestDatabase { @Value(#{systemProperties.databaseName}) public void setDatabaseName(String dbName) { } @Value(#{strategyBean.databaseKeyGenerator}) public void setKeyGenerator(KeyGenerator kg) { } }
10
EL Context Attributes
> Example showed access to EL attributes "systemProperties", "strategyBean" > implicit references in ex pressions
Implicit attributes to be ex posed by default, depending on runtime contex t e.g. "systemProperties", "systemEnvironment": global platform context access to all Spring- defined beans by name: similar to managed beans in JSF ex pressions extensible through Scope SPI: e.g. for step scope in Spring Batch
11
Exposure of all implicit JSF objects when running within a JSF request contex t "param", "initParam", "facesContex t", etc full compatibility with JSF managed bean facility seamless move between JSF expressions and Spring ex pressions supporting JSF 1.2 as well as JSF 2.0
12
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 first- class support for view rendering/ dispatching Alternative: using JAX- RS through integrated JAX- RS provider (e.g. Jersey) using the JAX- RS component model to build programmatic resource endpoints Spring integration available in all common JAX- RS providers already
>
>
13
14
@RequestMapping("/show") public Reward show(@RequestHeader("region") long regionId, @CookieValue("language") String langId) { ... }
15
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
16
17
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: to be supported for MVC data binding JSR- 3 0 3 "Bean Validation" as the common ground standardized constraint annotations
18
>
19
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 ex ecutor and scheduler setup similar to jms namespace
20
>
21
22
> Backwards compatibility with Spring 2.5 100% compatibility of programming model 95% compatibility of ex tension points All previously deprecated API to be removed Make sure you're not using outdated Spring 1.2 / 2.0 API anymore!
23
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 ex tends 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
24
Spring 3 .0 Roadmap
> Spring Framework 3.0 RC1 scheduled for July 2009 feature- complete and fully documented > Spring Framework 3.0 GA ex pected in August 2009 depending on RC feedback > Spring Framework 3.1 ex pected in early 2010 full compatibility with Java EE 6 platforms first- class support for conversation management
Jrgen Hller
www.springsource.com
SpringSource juergen.hoeller@springsource.com