40
Arjen Poutsma @poutsma SpringSource - a division of VMware What’s new in Spring 3.1? 1 donderdag 13 oktober 11

What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Arjen Poutsma@poutsma

SpringSource - a division of VMware

What’s new in Spring 3.1?

1donderdag 13 oktober 11

Page 2: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

• Spring 3.0

• Spring 3.1

• Release Schedule

Overview

2donderdag 13 oktober 11

Page 3: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Spring 3.0

3donderdag 13 oktober 11

Page 4: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

• Java 5+

• Spring Expression Language

• REST support

• Declarative model validation

• Early support for Java EE 6

Spring 3.0 Themes

4donderdag 13 oktober 11

Page 5: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Spring 3.1

5donderdag 13 oktober 11

Page 6: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

• Environment abstraction

• Java application configuration

• Cache abstraction

• @MVC improvements

Spring 3.1 Themes

6donderdag 13 oktober 11

Page 7: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Environment Abstraction

7donderdag 13 oktober 11

Page 8: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

SpringSource Confidential. Do not distribute without express permission

Cloud Foundry

IDE

Development

Tomcat

IntegrationTesting

tc Server

Pre-Production

tc Server

Production

Application

Spring

8donderdag 13 oktober 11

Page 9: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

• Various environments

• Development in IDE

• Integration testing in container

• Pre-production in container

• Production

• New: the Cloud

• Bonus challenge: immutable artefacts

The Environment Challenge

9donderdag 13 oktober 11

Page 10: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

• JNDI

• Only works in container

• System Properties

• Requires access to environment

• Separate application contexts

• Separate artefacts

• PropertyPlaceHolder-Configurer & friends

• Separate artefacts

• Requires access to environment

• Relatively confusing

Current solutions

10donderdag 13 oktober 11

Page 11: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

SpringSource Confidential. Do not distribute without express permission

SimpleObject

Dep

ende

ncy

Inje

ctio

nAO

P

Portable Service Abstractions

11donderdag 13 oktober 11

Page 12: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

• Group bean definitions by profile

• e.g. development, testing, production

• Specify which environment to use

Environment Abstraction

12donderdag 13 oktober 11

Page 13: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Group Beans

13donderdag 13 oktober 11

Page 14: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Grouping Beans (2)

14donderdag 13 oktober 11

Page 15: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Activate Profile

15donderdag 13 oktober 11

Page 16: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Activate Profile (2)

•  System properties– -Dspring.profiles.active=“dev”– -Dspring.profiles.default=“common”

• TestContext Framework

16donderdag 13 oktober 11

Page 17: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Java Application Configuration

17donderdag 13 oktober 11

Page 18: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Java-Based Application Configuration

XML JavaConfig

Namespaces @Enable*

FactoryBean Builders

GenericXmlContextLoader  AnnotationConfigContextLoader 

18donderdag 13 oktober 11

Page 19: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

@Enable

19donderdag 13 oktober 11

Page 20: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

@Enable

• @EnableTransactionManagement

• @EnableAsync

• @EnableScheduling

• @EnableLoadTimeWeaving

• @EnableWebMvc

• @EnableAspectJAutoProxy

20donderdag 13 oktober 11

Page 21: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

c Namespace

21donderdag 13 oktober 11

Page 22: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Cache Abstraction

22donderdag 13 oktober 11

Page 23: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

• @Cacheable and @CacheEvict

• Pluggable!

Caching Abstraction

23donderdag 13 oktober 11

Page 24: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

24

@Cacheable

24donderdag 13 oktober 11

Page 25: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Cache Configuration

25donderdag 13 oktober 11

Page 26: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

• Two available implementations

• EhCache

• ConcurrentMap

• JSR 107

• Pluggable!

Cache Providers

26donderdag 13 oktober 11

Page 27: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

@MVCImprovements

27donderdag 13 oktober 11

Page 28: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

• Introduced in Spring 2.5

• Major improvements in 3.0

• REST

• Further improvements in 3.1

• Complete refactoring

@MVC

28donderdag 13 oktober 11

Page 29: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

• Arguments

• ModelAndView

• ServletRequest and ServletResponse

• @RequestBody, @RequestHeader

• HttpEntity,

• …

• Return Types

• ModelAndView

• @ResponseBody

• ResponseEntity

• …

@MVC arguments and return values

29donderdag 13 oktober 11

Page 30: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Behind the Curtains

30donderdag 13 oktober 11

Page 31: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Custom argument and return value handlers

31donderdag 13 oktober 11

Page 32: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

@MVC 2.0

• Enabled by default

• <mvc:annotation-driven/>

• @EnableWebMvc

32donderdag 13 oktober 11

Page 33: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

• Two new elements on the RequestMapping annotation

• Consumes: consumable media types

• Content-Type header

• Produces: producible media types

• Accept header

Consumes and Produces

33donderdag 13 oktober 11

Page 34: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Consumes

34donderdag 13 oktober 11

Page 35: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Produces

35donderdag 13 oktober 11

Page 36: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Other @MVC tid-bits • @EnableWebMvc

• WebMvcConfiguration

• @PathVariable added to model

• Uri templates in “redirect:” locations

• Servlet 3.0 support

• no web.xml

• asynch requests

• file upload support

36donderdag 13 oktober 11

Page 37: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Summary

37donderdag 13 oktober 11

Page 38: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Spring 3.1• Environment and Profiles

• Java-based Configuration improvements

• Testing with @Configuration and Profiles

• Cache Abstraction

• MVC and REST Improvements

• Servlet 3.0

• c: Namespace

38donderdag 13 oktober 11

Page 39: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

• RC1 out yesterday!

• GA “Soon”

• Spring 3.2

• Java SE 7

• JDBC 4.1, JSF 2.2, JPA 2.1

• Fork-join

Release Schedule

39donderdag 13 oktober 11

Page 40: What’s new in Spring 3.1? · • Spring 3.1 • Release Schedule Overview ... • REST support • Declarative model validation • Early support for Java EE 6 Spring 3.0 Themes

Q & A

If time permits...

40donderdag 13 oktober 11