what’s new in spring 3.1? · • spring 3.1 • release schedule overview ... • rest support...
TRANSCRIPT
Arjen Poutsma@poutsma
SpringSource - a division of VMware
What’s new in Spring 3.1?
1donderdag 13 oktober 11
• Spring 3.0
• Spring 3.1
• Release Schedule
Overview
2donderdag 13 oktober 11
Spring 3.0
3donderdag 13 oktober 11
• Java 5+
• Spring Expression Language
• REST support
• Declarative model validation
• Early support for Java EE 6
Spring 3.0 Themes
4donderdag 13 oktober 11
Spring 3.1
5donderdag 13 oktober 11
• Environment abstraction
• Java application configuration
• Cache abstraction
• @MVC improvements
Spring 3.1 Themes
6donderdag 13 oktober 11
Environment Abstraction
7donderdag 13 oktober 11
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
• 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
• 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
SpringSource Confidential. Do not distribute without express permission
SimpleObject
Dep
ende
ncy
Inje
ctio
nAO
P
Portable Service Abstractions
11donderdag 13 oktober 11
• Group bean definitions by profile
• e.g. development, testing, production
• Specify which environment to use
Environment Abstraction
12donderdag 13 oktober 11
Group Beans
13donderdag 13 oktober 11
Grouping Beans (2)
14donderdag 13 oktober 11
Activate Profile
15donderdag 13 oktober 11
Activate Profile (2)
• System properties– -Dspring.profiles.active=“dev”– -Dspring.profiles.default=“common”
• TestContext Framework
16donderdag 13 oktober 11
Java Application Configuration
17donderdag 13 oktober 11
Java-Based Application Configuration
XML JavaConfig
Namespaces @Enable*
FactoryBean Builders
GenericXmlContextLoader AnnotationConfigContextLoader
18donderdag 13 oktober 11
@Enable
19donderdag 13 oktober 11
@Enable
• @EnableTransactionManagement
• @EnableAsync
• @EnableScheduling
• @EnableLoadTimeWeaving
• @EnableWebMvc
• @EnableAspectJAutoProxy
20donderdag 13 oktober 11
c Namespace
21donderdag 13 oktober 11
Cache Abstraction
22donderdag 13 oktober 11
• @Cacheable and @CacheEvict
• Pluggable!
Caching Abstraction
23donderdag 13 oktober 11
24
@Cacheable
24donderdag 13 oktober 11
Cache Configuration
25donderdag 13 oktober 11
• Two available implementations
• EhCache
• ConcurrentMap
• JSR 107
• Pluggable!
Cache Providers
26donderdag 13 oktober 11
@MVCImprovements
27donderdag 13 oktober 11
• Introduced in Spring 2.5
• Major improvements in 3.0
• REST
• Further improvements in 3.1
• Complete refactoring
@MVC
28donderdag 13 oktober 11
• Arguments
• ModelAndView
• ServletRequest and ServletResponse
• @RequestBody, @RequestHeader
• HttpEntity,
• …
• Return Types
• ModelAndView
• @ResponseBody
• ResponseEntity
• …
@MVC arguments and return values
29donderdag 13 oktober 11
Behind the Curtains
30donderdag 13 oktober 11
Custom argument and return value handlers
31donderdag 13 oktober 11
@MVC 2.0
• Enabled by default
• <mvc:annotation-driven/>
• @EnableWebMvc
32donderdag 13 oktober 11
• 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
Consumes
34donderdag 13 oktober 11
Produces
35donderdag 13 oktober 11
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
Summary
37donderdag 13 oktober 11
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
• 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
Q & A
If time permits...
40donderdag 13 oktober 11