SlideShare a Scribd company logo
1 of 79
Spring Framework 3.2
What‟s New? What‟s Coming?




Sam Brannen
@sam_brannen


JUG.ch | Zurich | 22 January 2013
Sam Brannen

• Spring and Java Consultant @ Swiftmind

• Developing Java for over 15 years

• Spring Framework Core Committer since 2007

• Spring Trainer

• Lead author of Spring Distilled (O‟Reilly)

• Presenter on Spring, Java, OSGi, and testing

                                                 2
Swiftmind

Your Experts for Enterprise Java

Experienced consultants with in-depth knowledge of:

    –   Spring
    –   Java EE
    –   OSGi
    –   Agile project methodologies
    –   Software engineering best practices

•   Headquarters: Zurich, Switzerland

•   http://www.swiftmind.com

                                                      3
A Show of Hands…




                   4
Agenda

•   Major Themes in 3.2
•   Community and Contributions
•   Spring MVC Updates
•   Spring TestContext Framework Updates
•   Spring MVC Test Framework
•   4.0 Roadmap
•   Q&A




                                           5
Major Themes in 3.2

• Build system and source control changes

• Java 7 with inlined ASM 4.0 and CGLIB 3.0
• Composable injection annotations
• Early JCache (JSR-107) support

• Async MVC processing on Servlet 3.0
• REST support refinements

• Testing web apps and Spring MVC Test Framework

• Several runtime and performance refinements

                                                   6
Java SE 7

• Spring 3.1 came with early support for Java 7
   – JDBC 4.1, ForkJoinPool, etc.
   – framework itself still compiled on Java 6

• Spring 3.2 is now being built on OpenJDK 7
   – with fine-tuning for Java 7 based tests, etc.
   – retaining compatibility with Java 5 & 6




                                                     7
ASM 4.0 & CGLIB 3.0

• Spring 3.2 comes with ASM 4.0 and CGLIB 3.0

   – fully supporting the Java 7 byte code format

   – ASM and CGLIB are now inlined into Spring module
     jars




                                                        8
Composable Injection Annotations

•   Meta-annotations work for @Autowired, @Value, and @Bean as well

@Autowired @MyQualifier
@Retention(RetentionPolicy.RUNTIME)
public @interface MyAutowired {}

@Value("#{systemProperties.myPort}")
@Retention(RetentionPolicy.RUNTIME)
public @interface MyPort {}

@Bean @MyQualifier @Lazy
@Retention(RetentionPolicy.RUNTIME)
public @interface MyBean {}


                                                                      9
Early JCache Support

• Aligned with Spring's cache abstraction
   – Built against JCache 0.5 (JSR-107 draft)

• JCacheCacheManager and JCacheManagerFactoryBean
   – next to spiced-up versions of our
     EhCacheCacheManager

• No out-of-the-box support for native JCache annotations
  yet
   – planned for 2013, once the JCache specification is final



                                                                10
Community and Contributions




                              11
Big Infrastructure Changes

• Moved Spring Framework sources from self-hosted
  Subversion to Git/GitHub

• Migrated from Spring Build (i.e., Ant + Ivy) to Gradle

• New SpringSource Artifactory repository
   – http://repo.springsource.org
   – https://github.com/SpringSource/spring-
     framework/wiki/SpringSource-repository-FAQ




                                                           12
GitHub Repositories




                      13
GitHub – Timeline

• Dec 2011: Spring Framework moved to GitHub

• Dec 2012: 600+ forks; 200+ pull requests (thank you!)




                                                          14
Ways to Contribute (1/4)

• Answering questions on the Spring Forums and
  StackOverflow

   – A great way to help others and build your own
     reputation




                                                     15
Spring on StackOverflow




                          16
Ways to Contribute (2/4)

• Submitting bug reports

  – Because we can't fix what we don‟t know is broken!



• Suggesting new features or improvements




                                                         17
Ways to Contribute (3/4)

• Trying out new features in snapshots, milestones, and
  release candidates

   – Providing critical feedback for the team towards the
     next major version




                                                          18
Snapshot, Milestone, & RC Artifacts




                                      19
Ways to Contribute (4/4)

• Contributing code

   – To “scratch your own itch”

   – To get (much!) more familiar with the framework

   – To build your own reputation




                                                       20
Building from Source

Gradle build makes building from source dead simple

• git and JDK 7 are the only requirements

• clone the repo; run `./gradlew build`

• built-in scripts help with importing sources into
  Eclipse/STS or IDEA

• https://github.com/SpringSource/spring-
  framework/#building-from-source


                                                      21
Submitting Pull Requests

Pull Requests are a big help

• Much better than traditional patches

• https://github.com/SpringSource/springframework/blob/
  master/CONTRIBUTING.md




                                                          22
Reproducing Issues

New spring-framework-issues repository

• Submit “reproduction projects” that demonstrate JIRA
  issues

• See https://github.com/SpringSource/spring-framework-
  issues#readme




                                                          23
Contributions are Welcome!

• Interested in contributing?
• Want to know which issues are best to work on?

• See the new Contributions Welcome fixVersion in SPR
  JIRA

• We‟ll add issues here that we think are great candidates
  for community contribution




                                                             24
Contributions Welcome




                        25
Staying Informed

• Stay in touch with the team via Twitter
   – https://twitter.com/springframework
   – https://twitter.com/springframework/team/members


• Subscribe to the SpringSource Newsletter
   – http://www.springsource.org/newsletter-subscription


• Spring Framework Contributors Google Group
   – https://groups.google.com/forum/#!forum/spring-
     framework-contrib




                                                           26
Spring MVC Updates




                     27
Servlet 3 Async Support

• What?
  – Separate processing from Servlet container thread

• How?
   – Start async processing via request.startAsync()
   – Exit container thread
   – Compute in another thread
   – Dispatch to container to complete processing

• Why?
  – Support for long running requests – e.g. long polling
  – Increased throughput

                                                            28
Spring MVC – Servlet 3 Async Support

New controller method return value types:

• java.util.Callable<?>
   – Actual return value to be obtained via Callable
   – Spring MVC invokes Callable in separate thread

• org.springframework.web.*.DeferredResult<?>
   – Actual return value to be set on the DeferredResult
   – Application sets DeferredResult from a thread of its
     choice



                                                            29
java.util.Callable<?>

•   Before:



•   After:




•   Do the same with any controller return value type
     – String, ModelAndView, ResponseEntity<?>, …

                                                        30
org.sfw.web.*.DeferredResult<?>

• Create and save a DeferredResult:




• Set the deferred result to complete processing:




                                                    31
Server-side Push via Long Polling

•   Browser sends a request
•   Controller method returns a DeferredResult
•   Servlet container thread is exited but response is open
•   External event takes place – e.g. JMS, AMQP notification
•   DeferredResult is set
•   Request is dispatched back to Servlet container
•   Processing resumes and completes


    See blog post on real-time update techniques:
    http://bit.ly/IWxRhI


                                                               32
Servlet 3 Async Configuration

• Set async-supported flag on Servlet and all filters
   – <async-supported>true</async-supported>



• Set <dispatcher> element on filter-mapping
   – <dispatcher>REQUEST, ASYNC, FORWARD</dispatcher>




                                                        33
Spring MVC Servlet 3 Async – Resources

• Blog post series
   – http://bit.ly/JIZwSV

• Samples
   – https://github.com/SpringSource/spring-mvc-showcase
   – https://github.com/rstoyanchev/spring-mvc-chat
   – http://bit.ly/VMLLuL … Spring AMQP stocks sample

• Reference documentation
   – http://bit.ly/UZzvsi




                                                           34
WebApplicationInitializer Base Classes




                                         35
Content Negotiation Options

•   Content negotiation via file extension, Accept
    header, request parameter, default value, or a custom
    strategy throughout Spring MVC

•   Choose which strategies to use and in what order

•   Configured once in MVC Java config or MVC namespace
     – “.json” and “.xml” extensions automatically enabled

•   May configure HandlerMapping/Adapter and
    ExceptionResolver via
    ContentNegotiationManagerFactoryBean


    For further details see: http://bit.ly/10cCcuG
                                                             36
Global Error Reporting

• Need an application–wide strategy for writing error details
  to the response body?

• Wishing there were a global @ExceptionHandler method?

• Well, now there is!




                                                            37
Matrix Variables

•   Parameters embedded in URI path segments
     – GET /pets/42;q=21

•   Use URI variable where semi-colon content expected
     – /pets/{petId}

•   Extract via annotation
     – @PathVariable String petId, @MatrixVariable int q

•   Some configuration required to enable unless using MVC
    Java config and MVC namespace


    For further details see: http://bit.ly/WBm2ov

                                                             38
Spring TestContext Framework Updates




                                       39
What‟s New in the Spring TCF?

• Upgraded to JUnit 4.11 and TestNG 6.5.2

• Loading WebApplicationContexts

• Testing request- and session-scoped beans

• Support for ApplicationContextInitializers

• Loading context hierarchies (3.2.1)

• And more… (see presentation from SpringOne 2GX 2012)

                                                         40
Loading a WebApplicationContext

• Q: How do you tell the TestContext Framework to load a
  WebApplicationContext?

• A: Just annotate your test class with
  @WebAppConfiguration!




                                                           41
@WebAppConfiguration

• Denotes that the context should be a
  WebApplicationContext

• Configures the resource path for the web app
   – Used by MockServletContext
   – Defaults to “src/main/webapp”
   – Paths are file-system folders, relative to the project
     root not classpath resources
   – The classpath: prefix is also supported




                                                              42
Example: @WebAppConfiguration




                                43
Example: @WebAppConfiguration




                                44
Example: @WebAppConfiguration




                                45
ServletTestExecutionListener

• Sets up default thread-local state via
  RequestContextHolder before each test method

• Creates:
   – MockHttpServletRequest
   – MockHttpServletResponse
   – ServletWebRequest

• Ensures that the MockHttpServletResponse and
  ServletWebRequest can be injected into the test instance

• Cleans up thread-local state after each test method


                                                             46
Example: Injecting Mocks




                           47
Web Scopes – Review

• request: lifecycle tied to the current HttpServletRequest



• session: lifecycle tied to the current HttpSession




                                                              48
Example: Request-scoped Bean Config




                                      49
Example: Request-scoped Bean Test




                                    50
Example: Session-scoped Bean Config




                                      51
Example: Session-scoped Bean Test




                                    52
ApplicationContextInitalizer

• Introduced in Spring 3.1
• Used for programmatic initialization of a
  ConfigurableApplicationContext
• For example:
   – to register property sources
   – to activate profiles against the Environment
• Configured in web.xml by specifying
  contextInitializerClasses via
   – context-param for the ContextLoaderListener
   – init-param for the DispatcherServlet



                                                    53
Using Initializers in Tests

• Configured in @ContextConfiguration via the initializers
  attribute
• Inheritance can be controlled via the inheritInitializers
  attribute
• An ApplicationContextInitializer may configure the entire
  context
   – XML resource locations or annotated classes are no
      longer required
• Initializers are now part of the context cache key
• Initializers are ordered based on Spring's Ordered
  interface or the @Order annotation


                                                              54
Example: Multiple Initializers




                                 55
Application Context Hierarchies

• Currently only flat, non-hierarchical contexts are
  supported in tests.

• There‟s no easy way to create contexts with parent-child
  relationships.

• But… hierarchies are supported in production.

• Wouldn‟t it be nice if you could test them, too?!




                                                             56
Testing Context Hierarchies in 3.2.2

• New @ContextHierarchy annotation
   – Used in conjunction with @ContextConfiguration

• @ContextConfiguration now supports a „name‟ attribute
  – for merging and overriding hierarchy configuration




                                                          57
Single Test with Context Hierarchy




                                     58
Class and Context Hierarchies




                                59
Spring MVC Test Framework




                            60
What is Spring MVC Test?

• First class support for testing Spring MVC applications

• Fluent API

• Server-side tests involve the DispatcherServlet

• Client-side tests are RestTemplate based

• Built on spring-test and
  MockHttpServletRequest/Response

• Servlet container not required

                                                            61
Q: Unit or Integration Testing?




                                  62
A: A Bit of Both

• Integration tests for sure
• However…
   – no Servlet container
   – MockHttpServletRequest/Response
   – Controllers can be injected with mocks
• Also there are two setup options
   – Load WebApplicationContext as usual
   – Standalone setup … no Spring configuration, just
     controller instance!

• Controller unit testing ++

                                                        63
Server-side Test: webAppContextSetup




                                       64
Server-side Test: standaloneSetup




                                    65
Client-side Test




                   66
Spring MVC Test – Resources

• Blog post
  – http://bit.ly/QCKMzh

• Samples
  – https://github.com/SpringSource/spring-mvc-showcase
  – http://bit.ly/VN1bPw … sample server tests
  – http://bit.ly/13koRQP … sample client tests


• Reference documentation
  – http://bit.ly/SmUtD6




                                                          67
Roadmap for Spring 4.0




                         68
1st Class Support for Java 8 based apps

• Language features such as lambda expressions
   – for callbacks with templates
   – for concurrent execution
       • think fork/join, map/reduce, etc.

• APIs such as JSR-310 Date and Time
   – Alongside Spring‟s existing support for JodaTime




                                                        69
Configuring Spring with Groovy 2

• Configuring and implementing Spring-style applications
  using Groovy 2.x

• Groovy-based bean definitions

• Groovy as the language of choice for an entire
  application, as a direct and straightforward alternative to
  Java source files

• Groovy 2.0's static compilation support completes the
  picture here


                                                                70
Support for Key Java EE 7 Technologies

• JMS 2.0

• JPA 2.1

• Bean Validation 1.1

• Servlet 3.1

• And fully covering JCache 1.0




                                         71
Enabling WebSocket-style Architectures

• Support for JSR-356 compliant runtimes

• Also supporting related technologies




                                           72
Fine-grained Eventing and Messaging

• Introducing fine-grained eventing and messaging within
  the application

• Building on our existing application event mechanism

• Aligned with our JMS message listener mechanism




                                                           73
Pruning and Dependency Upgrades

• Removing a variety of deprecated packages across the
  framework
   – See Spring Framework 3.2's deprecations!

• Raising minimum dependencies to Java 6+
   – Java SE 6+ and Java EE 6+
   – with some compromises for EE 5++ servers




                                                         74
In Closing…




              75
Special Thanks to…

• Juergen Hoeller

• Chris Beams

• Rossen Stoyanchev

… for permitting reuse of some of their content in this presentation!




                                                                    76
Further Resources

• Spring Framework
   – http://www.springsource.org/spring-framework
   – Spring Reference Manual
   – Javadoc
• Spring Forums
   – http://forum.springframework.org
• Spring JIRA
   – http://jira.springframework.org
• Spring on GitHub
   – https://github.com/SpringSource/spring-framework



                                                        77
Blogs

• SpringSource Team Blog
   – http://blog.springsource.com/

• Swiftmind Team Blog
   – http://www.swiftmind.com/blog/




                                      78
Q&A

Sam Brannen

twitter: @sam_brannen
www.slideshare.net/sbrannen
www.swiftmind.com




                              79

More Related Content

What's hot

Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Robert Scholte
 
Workshop Framework(J2EE/OSGi/RCP)
Workshop Framework(J2EE/OSGi/RCP)Workshop Framework(J2EE/OSGi/RCP)
Workshop Framework(J2EE/OSGi/RCP)Summer Lu
 
Maven 3 Overview
Maven 3  OverviewMaven 3  Overview
Maven 3 OverviewMike Ensor
 
Batching and Java EE (jdk.io)
Batching and Java EE (jdk.io)Batching and Java EE (jdk.io)
Batching and Java EE (jdk.io)Ryan Cuprak
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - ExplainedSmita Prasad
 
Testing Spring Boot Applications
Testing Spring Boot ApplicationsTesting Spring Boot Applications
Testing Spring Boot ApplicationsVMware Tanzu
 
Maven for Dummies
Maven for DummiesMaven for Dummies
Maven for DummiesTomer Gabel
 
Triple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDev
Triple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDevTriple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDev
Triple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDevWerner Keil
 
Learning Maven by Example
Learning Maven by ExampleLearning Maven by Example
Learning Maven by ExampleHsi-Kai Wang
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experienceAlex Tumanoff
 
Scala and Play with Gradle
Scala and Play with GradleScala and Play with Gradle
Scala and Play with GradleWei Chen
 

What's hot (20)

Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)
 
Java EE 8
Java EE 8Java EE 8
Java EE 8
 
Workshop Framework(J2EE/OSGi/RCP)
Workshop Framework(J2EE/OSGi/RCP)Workshop Framework(J2EE/OSGi/RCP)
Workshop Framework(J2EE/OSGi/RCP)
 
Maven 3 Overview
Maven 3  OverviewMaven 3  Overview
Maven 3 Overview
 
Batching and Java EE (jdk.io)
Batching and Java EE (jdk.io)Batching and Java EE (jdk.io)
Batching and Java EE (jdk.io)
 
Apache Maven 2 Part 2
Apache Maven 2 Part 2Apache Maven 2 Part 2
Apache Maven 2 Part 2
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
 
JSF2
JSF2JSF2
JSF2
 
Testing Spring Boot Applications
Testing Spring Boot ApplicationsTesting Spring Boot Applications
Testing Spring Boot Applications
 
Apache Maven In 10 Slides
Apache Maven In 10 SlidesApache Maven In 10 Slides
Apache Maven In 10 Slides
 
Maven tutorial
Maven tutorialMaven tutorial
Maven tutorial
 
Apache maven 2 overview
Apache maven 2 overviewApache maven 2 overview
Apache maven 2 overview
 
Maven for Dummies
Maven for DummiesMaven for Dummies
Maven for Dummies
 
Maven ppt
Maven pptMaven ppt
Maven ppt
 
Triple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDev
Triple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDevTriple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDev
Triple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDev
 
Learning Maven by Example
Learning Maven by ExampleLearning Maven by Example
Learning Maven by Example
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experience
 
Maven
Maven Maven
Maven
 
Scala and Play with Gradle
Scala and Play with GradleScala and Play with Gradle
Scala and Play with Gradle
 
Maven advanced
Maven advancedMaven advanced
Maven advanced
 

Similar to Spring Framework 3.2 - What's New

Testing Spring MVC and REST Web Applications
Testing Spring MVC and REST Web ApplicationsTesting Spring MVC and REST Web Applications
Testing Spring MVC and REST Web ApplicationsSam Brannen
 
Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Henry S
 
CTS2 Development Framework
CTS2 Development FrameworkCTS2 Development Framework
CTS2 Development Frameworkcts2framework
 
The Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen CambridgeThe Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen CambridgePhil Pursglove
 
Continuous Deployment of your Application @jSession#5
Continuous Deployment of your Application @jSession#5Continuous Deployment of your Application @jSession#5
Continuous Deployment of your Application @jSession#5Marcin Grzejszczak
 
The Need For Speed - NEBytes
The Need For Speed - NEBytesThe Need For Speed - NEBytes
The Need For Speed - NEBytesPhil Pursglove
 
Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...
Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...
Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...HostedbyConfluent
 
Spring Cloud: API gateway upgrade & configuration in the cloud
Spring Cloud: API gateway upgrade & configuration in the cloudSpring Cloud: API gateway upgrade & configuration in the cloud
Spring Cloud: API gateway upgrade & configuration in the cloudOrkhan Gasimov
 
Continuous Deployment To The Cloud @DevoxxPL 2017
Continuous Deployment To The Cloud @DevoxxPL 2017 Continuous Deployment To The Cloud @DevoxxPL 2017
Continuous Deployment To The Cloud @DevoxxPL 2017 Marcin Grzejszczak
 
Sitecore development approach evolution – destination helix
Sitecore development approach evolution – destination helixSitecore development approach evolution – destination helix
Sitecore development approach evolution – destination helixPeter Nazarov
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework Serhat Can
 
DevOps: Automate all the things
DevOps: Automate all the thingsDevOps: Automate all the things
DevOps: Automate all the thingsMat Mannion
 
Fast Track introduction to ASP.NET MVC
Fast Track introduction to ASP.NET MVCFast Track introduction to ASP.NET MVC
Fast Track introduction to ASP.NET MVCAnkit Kashyap
 
The Need for Speed - EpiCenter 2010
The Need for Speed - EpiCenter 2010The Need for Speed - EpiCenter 2010
The Need for Speed - EpiCenter 2010Phil Pursglove
 
Phil Pursglove: Velocity, the Need for Speed - epicenter 2010
Phil Pursglove: Velocity, the Need for Speed - epicenter 2010Phil Pursglove: Velocity, the Need for Speed - epicenter 2010
Phil Pursglove: Velocity, the Need for Speed - epicenter 2010IrishDev.com
 
Streaming to a new Jakarta EE / JOTB19
Streaming to a new Jakarta EE / JOTB19Streaming to a new Jakarta EE / JOTB19
Streaming to a new Jakarta EE / JOTB19Markus Eisele
 
Composable Software Architecture with Spring
Composable Software Architecture with SpringComposable Software Architecture with Spring
Composable Software Architecture with SpringSam Brannen
 

Similar to Spring Framework 3.2 - What's New (20)

Testing Spring MVC and REST Web Applications
Testing Spring MVC and REST Web ApplicationsTesting Spring MVC and REST Web Applications
Testing Spring MVC and REST Web Applications
 
Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1
 
CTS2 Development Framework
CTS2 Development FrameworkCTS2 Development Framework
CTS2 Development Framework
 
The Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen CambridgeThe Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen Cambridge
 
Velocity - Edge UG
Velocity - Edge UGVelocity - Edge UG
Velocity - Edge UG
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
 
Continuous Deployment of your Application @jSession#5
Continuous Deployment of your Application @jSession#5Continuous Deployment of your Application @jSession#5
Continuous Deployment of your Application @jSession#5
 
The Need For Speed - NEBytes
The Need For Speed - NEBytesThe Need For Speed - NEBytes
The Need For Speed - NEBytes
 
Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...
Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...
Kafka for Microservices – You absolutely need Avro Schemas! | Gerardo Gutierr...
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring Cloud: API gateway upgrade & configuration in the cloud
Spring Cloud: API gateway upgrade & configuration in the cloudSpring Cloud: API gateway upgrade & configuration in the cloud
Spring Cloud: API gateway upgrade & configuration in the cloud
 
Continuous Deployment To The Cloud @DevoxxPL 2017
Continuous Deployment To The Cloud @DevoxxPL 2017 Continuous Deployment To The Cloud @DevoxxPL 2017
Continuous Deployment To The Cloud @DevoxxPL 2017
 
Sitecore development approach evolution – destination helix
Sitecore development approach evolution – destination helixSitecore development approach evolution – destination helix
Sitecore development approach evolution – destination helix
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
DevOps: Automate all the things
DevOps: Automate all the thingsDevOps: Automate all the things
DevOps: Automate all the things
 
Fast Track introduction to ASP.NET MVC
Fast Track introduction to ASP.NET MVCFast Track introduction to ASP.NET MVC
Fast Track introduction to ASP.NET MVC
 
The Need for Speed - EpiCenter 2010
The Need for Speed - EpiCenter 2010The Need for Speed - EpiCenter 2010
The Need for Speed - EpiCenter 2010
 
Phil Pursglove: Velocity, the Need for Speed - epicenter 2010
Phil Pursglove: Velocity, the Need for Speed - epicenter 2010Phil Pursglove: Velocity, the Need for Speed - epicenter 2010
Phil Pursglove: Velocity, the Need for Speed - epicenter 2010
 
Streaming to a new Jakarta EE / JOTB19
Streaming to a new Jakarta EE / JOTB19Streaming to a new Jakarta EE / JOTB19
Streaming to a new Jakarta EE / JOTB19
 
Composable Software Architecture with Spring
Composable Software Architecture with SpringComposable Software Architecture with Spring
Composable Software Architecture with Spring
 

More from Sam Brannen

Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Sam Brannen
 
Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022Sam Brannen
 
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019Sam Brannen
 
JUnit 5: What's New and What's Coming - Spring I/O 2019
JUnit 5: What's New and What's Coming - Spring I/O 2019JUnit 5: What's New and What's Coming - Spring I/O 2019
JUnit 5: What's New and What's Coming - Spring I/O 2019Sam Brannen
 
JUnit 5 - New Opportunities for Testing on the JVM
JUnit 5 - New Opportunities for Testing on the JVMJUnit 5 - New Opportunities for Testing on the JVM
JUnit 5 - New Opportunities for Testing on the JVMSam Brannen
 
Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2Sam Brannen
 
JUnit 5 - from Lambda to Alpha and beyond
JUnit 5 - from Lambda to Alpha and beyondJUnit 5 - from Lambda to Alpha and beyond
JUnit 5 - from Lambda to Alpha and beyondSam Brannen
 
Testing with Spring 4.x
Testing with Spring 4.xTesting with Spring 4.x
Testing with Spring 4.xSam Brannen
 
Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Sam Brannen
 
Spring Framework 4.0 to 4.1
Spring Framework 4.0 to 4.1Spring Framework 4.0 to 4.1
Spring Framework 4.0 to 4.1Sam Brannen
 
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013Sam Brannen
 
Spring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4DevelopersSpring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4DevelopersSam Brannen
 
Effective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4DevelopersEffective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4DevelopersSam Brannen
 
Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012Sam Brannen
 
Spring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSpring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSam Brannen
 
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 3.1 in a Nutshell
Spring 3.1 in a NutshellSpring 3.1 in a Nutshell
Spring 3.1 in a NutshellSam Brannen
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSam Brannen
 
Effective out-of-container Integration Testing
Effective out-of-container Integration TestingEffective out-of-container Integration Testing
Effective out-of-container Integration TestingSam Brannen
 
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
 

More from Sam Brannen (20)

Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
 
Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022
 
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
 
JUnit 5: What's New and What's Coming - Spring I/O 2019
JUnit 5: What's New and What's Coming - Spring I/O 2019JUnit 5: What's New and What's Coming - Spring I/O 2019
JUnit 5: What's New and What's Coming - Spring I/O 2019
 
JUnit 5 - New Opportunities for Testing on the JVM
JUnit 5 - New Opportunities for Testing on the JVMJUnit 5 - New Opportunities for Testing on the JVM
JUnit 5 - New Opportunities for Testing on the JVM
 
Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2
 
JUnit 5 - from Lambda to Alpha and beyond
JUnit 5 - from Lambda to Alpha and beyondJUnit 5 - from Lambda to Alpha and beyond
JUnit 5 - from Lambda to Alpha and beyond
 
Testing with Spring 4.x
Testing with Spring 4.xTesting with Spring 4.x
Testing with Spring 4.x
 
Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2
 
Spring Framework 4.0 to 4.1
Spring Framework 4.0 to 4.1Spring Framework 4.0 to 4.1
Spring Framework 4.0 to 4.1
 
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
 
Spring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4DevelopersSpring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4Developers
 
Effective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4DevelopersEffective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4Developers
 
Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012
 
Spring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSpring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing Support
 
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 3.1 in a Nutshell
Spring 3.1 in a NutshellSpring 3.1 in a Nutshell
Spring 3.1 in a Nutshell
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
Effective out-of-container Integration Testing
Effective out-of-container Integration TestingEffective out-of-container Integration Testing
Effective out-of-container Integration Testing
 
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
 

Recently uploaded

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Recently uploaded (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 

Spring Framework 3.2 - What's New

  • 1. Spring Framework 3.2 What‟s New? What‟s Coming? Sam Brannen @sam_brannen JUG.ch | Zurich | 22 January 2013
  • 2. Sam Brannen • Spring and Java Consultant @ Swiftmind • Developing Java for over 15 years • Spring Framework Core Committer since 2007 • Spring Trainer • Lead author of Spring Distilled (O‟Reilly) • Presenter on Spring, Java, OSGi, and testing 2
  • 3. Swiftmind Your Experts for Enterprise Java Experienced consultants with in-depth knowledge of: – Spring – Java EE – OSGi – Agile project methodologies – Software engineering best practices • Headquarters: Zurich, Switzerland • http://www.swiftmind.com 3
  • 4. A Show of Hands… 4
  • 5. Agenda • Major Themes in 3.2 • Community and Contributions • Spring MVC Updates • Spring TestContext Framework Updates • Spring MVC Test Framework • 4.0 Roadmap • Q&A 5
  • 6. Major Themes in 3.2 • Build system and source control changes • Java 7 with inlined ASM 4.0 and CGLIB 3.0 • Composable injection annotations • Early JCache (JSR-107) support • Async MVC processing on Servlet 3.0 • REST support refinements • Testing web apps and Spring MVC Test Framework • Several runtime and performance refinements 6
  • 7. Java SE 7 • Spring 3.1 came with early support for Java 7 – JDBC 4.1, ForkJoinPool, etc. – framework itself still compiled on Java 6 • Spring 3.2 is now being built on OpenJDK 7 – with fine-tuning for Java 7 based tests, etc. – retaining compatibility with Java 5 & 6 7
  • 8. ASM 4.0 & CGLIB 3.0 • Spring 3.2 comes with ASM 4.0 and CGLIB 3.0 – fully supporting the Java 7 byte code format – ASM and CGLIB are now inlined into Spring module jars 8
  • 9. Composable Injection Annotations • Meta-annotations work for @Autowired, @Value, and @Bean as well @Autowired @MyQualifier @Retention(RetentionPolicy.RUNTIME) public @interface MyAutowired {} @Value("#{systemProperties.myPort}") @Retention(RetentionPolicy.RUNTIME) public @interface MyPort {} @Bean @MyQualifier @Lazy @Retention(RetentionPolicy.RUNTIME) public @interface MyBean {} 9
  • 10. Early JCache Support • Aligned with Spring's cache abstraction – Built against JCache 0.5 (JSR-107 draft) • JCacheCacheManager and JCacheManagerFactoryBean – next to spiced-up versions of our EhCacheCacheManager • No out-of-the-box support for native JCache annotations yet – planned for 2013, once the JCache specification is final 10
  • 12. Big Infrastructure Changes • Moved Spring Framework sources from self-hosted Subversion to Git/GitHub • Migrated from Spring Build (i.e., Ant + Ivy) to Gradle • New SpringSource Artifactory repository – http://repo.springsource.org – https://github.com/SpringSource/spring- framework/wiki/SpringSource-repository-FAQ 12
  • 14. GitHub – Timeline • Dec 2011: Spring Framework moved to GitHub • Dec 2012: 600+ forks; 200+ pull requests (thank you!) 14
  • 15. Ways to Contribute (1/4) • Answering questions on the Spring Forums and StackOverflow – A great way to help others and build your own reputation 15
  • 17. Ways to Contribute (2/4) • Submitting bug reports – Because we can't fix what we don‟t know is broken! • Suggesting new features or improvements 17
  • 18. Ways to Contribute (3/4) • Trying out new features in snapshots, milestones, and release candidates – Providing critical feedback for the team towards the next major version 18
  • 19. Snapshot, Milestone, & RC Artifacts 19
  • 20. Ways to Contribute (4/4) • Contributing code – To “scratch your own itch” – To get (much!) more familiar with the framework – To build your own reputation 20
  • 21. Building from Source Gradle build makes building from source dead simple • git and JDK 7 are the only requirements • clone the repo; run `./gradlew build` • built-in scripts help with importing sources into Eclipse/STS or IDEA • https://github.com/SpringSource/spring- framework/#building-from-source 21
  • 22. Submitting Pull Requests Pull Requests are a big help • Much better than traditional patches • https://github.com/SpringSource/springframework/blob/ master/CONTRIBUTING.md 22
  • 23. Reproducing Issues New spring-framework-issues repository • Submit “reproduction projects” that demonstrate JIRA issues • See https://github.com/SpringSource/spring-framework- issues#readme 23
  • 24. Contributions are Welcome! • Interested in contributing? • Want to know which issues are best to work on? • See the new Contributions Welcome fixVersion in SPR JIRA • We‟ll add issues here that we think are great candidates for community contribution 24
  • 26. Staying Informed • Stay in touch with the team via Twitter – https://twitter.com/springframework – https://twitter.com/springframework/team/members • Subscribe to the SpringSource Newsletter – http://www.springsource.org/newsletter-subscription • Spring Framework Contributors Google Group – https://groups.google.com/forum/#!forum/spring- framework-contrib 26
  • 28. Servlet 3 Async Support • What? – Separate processing from Servlet container thread • How? – Start async processing via request.startAsync() – Exit container thread – Compute in another thread – Dispatch to container to complete processing • Why? – Support for long running requests – e.g. long polling – Increased throughput 28
  • 29. Spring MVC – Servlet 3 Async Support New controller method return value types: • java.util.Callable<?> – Actual return value to be obtained via Callable – Spring MVC invokes Callable in separate thread • org.springframework.web.*.DeferredResult<?> – Actual return value to be set on the DeferredResult – Application sets DeferredResult from a thread of its choice 29
  • 30. java.util.Callable<?> • Before: • After: • Do the same with any controller return value type – String, ModelAndView, ResponseEntity<?>, … 30
  • 31. org.sfw.web.*.DeferredResult<?> • Create and save a DeferredResult: • Set the deferred result to complete processing: 31
  • 32. Server-side Push via Long Polling • Browser sends a request • Controller method returns a DeferredResult • Servlet container thread is exited but response is open • External event takes place – e.g. JMS, AMQP notification • DeferredResult is set • Request is dispatched back to Servlet container • Processing resumes and completes See blog post on real-time update techniques: http://bit.ly/IWxRhI 32
  • 33. Servlet 3 Async Configuration • Set async-supported flag on Servlet and all filters – <async-supported>true</async-supported> • Set <dispatcher> element on filter-mapping – <dispatcher>REQUEST, ASYNC, FORWARD</dispatcher> 33
  • 34. Spring MVC Servlet 3 Async – Resources • Blog post series – http://bit.ly/JIZwSV • Samples – https://github.com/SpringSource/spring-mvc-showcase – https://github.com/rstoyanchev/spring-mvc-chat – http://bit.ly/VMLLuL … Spring AMQP stocks sample • Reference documentation – http://bit.ly/UZzvsi 34
  • 36. Content Negotiation Options • Content negotiation via file extension, Accept header, request parameter, default value, or a custom strategy throughout Spring MVC • Choose which strategies to use and in what order • Configured once in MVC Java config or MVC namespace – “.json” and “.xml” extensions automatically enabled • May configure HandlerMapping/Adapter and ExceptionResolver via ContentNegotiationManagerFactoryBean For further details see: http://bit.ly/10cCcuG 36
  • 37. Global Error Reporting • Need an application–wide strategy for writing error details to the response body? • Wishing there were a global @ExceptionHandler method? • Well, now there is! 37
  • 38. Matrix Variables • Parameters embedded in URI path segments – GET /pets/42;q=21 • Use URI variable where semi-colon content expected – /pets/{petId} • Extract via annotation – @PathVariable String petId, @MatrixVariable int q • Some configuration required to enable unless using MVC Java config and MVC namespace For further details see: http://bit.ly/WBm2ov 38
  • 40. What‟s New in the Spring TCF? • Upgraded to JUnit 4.11 and TestNG 6.5.2 • Loading WebApplicationContexts • Testing request- and session-scoped beans • Support for ApplicationContextInitializers • Loading context hierarchies (3.2.1) • And more… (see presentation from SpringOne 2GX 2012) 40
  • 41. Loading a WebApplicationContext • Q: How do you tell the TestContext Framework to load a WebApplicationContext? • A: Just annotate your test class with @WebAppConfiguration! 41
  • 42. @WebAppConfiguration • Denotes that the context should be a WebApplicationContext • Configures the resource path for the web app – Used by MockServletContext – Defaults to “src/main/webapp” – Paths are file-system folders, relative to the project root not classpath resources – The classpath: prefix is also supported 42
  • 46. ServletTestExecutionListener • Sets up default thread-local state via RequestContextHolder before each test method • Creates: – MockHttpServletRequest – MockHttpServletResponse – ServletWebRequest • Ensures that the MockHttpServletResponse and ServletWebRequest can be injected into the test instance • Cleans up thread-local state after each test method 46
  • 48. Web Scopes – Review • request: lifecycle tied to the current HttpServletRequest • session: lifecycle tied to the current HttpSession 48
  • 53. ApplicationContextInitalizer • Introduced in Spring 3.1 • Used for programmatic initialization of a ConfigurableApplicationContext • For example: – to register property sources – to activate profiles against the Environment • Configured in web.xml by specifying contextInitializerClasses via – context-param for the ContextLoaderListener – init-param for the DispatcherServlet 53
  • 54. Using Initializers in Tests • Configured in @ContextConfiguration via the initializers attribute • Inheritance can be controlled via the inheritInitializers attribute • An ApplicationContextInitializer may configure the entire context – XML resource locations or annotated classes are no longer required • Initializers are now part of the context cache key • Initializers are ordered based on Spring's Ordered interface or the @Order annotation 54
  • 56. Application Context Hierarchies • Currently only flat, non-hierarchical contexts are supported in tests. • There‟s no easy way to create contexts with parent-child relationships. • But… hierarchies are supported in production. • Wouldn‟t it be nice if you could test them, too?! 56
  • 57. Testing Context Hierarchies in 3.2.2 • New @ContextHierarchy annotation – Used in conjunction with @ContextConfiguration • @ContextConfiguration now supports a „name‟ attribute – for merging and overriding hierarchy configuration 57
  • 58. Single Test with Context Hierarchy 58
  • 59. Class and Context Hierarchies 59
  • 60. Spring MVC Test Framework 60
  • 61. What is Spring MVC Test? • First class support for testing Spring MVC applications • Fluent API • Server-side tests involve the DispatcherServlet • Client-side tests are RestTemplate based • Built on spring-test and MockHttpServletRequest/Response • Servlet container not required 61
  • 62. Q: Unit or Integration Testing? 62
  • 63. A: A Bit of Both • Integration tests for sure • However… – no Servlet container – MockHttpServletRequest/Response – Controllers can be injected with mocks • Also there are two setup options – Load WebApplicationContext as usual – Standalone setup … no Spring configuration, just controller instance! • Controller unit testing ++ 63
  • 67. Spring MVC Test – Resources • Blog post – http://bit.ly/QCKMzh • Samples – https://github.com/SpringSource/spring-mvc-showcase – http://bit.ly/VN1bPw … sample server tests – http://bit.ly/13koRQP … sample client tests • Reference documentation – http://bit.ly/SmUtD6 67
  • 69. 1st Class Support for Java 8 based apps • Language features such as lambda expressions – for callbacks with templates – for concurrent execution • think fork/join, map/reduce, etc. • APIs such as JSR-310 Date and Time – Alongside Spring‟s existing support for JodaTime 69
  • 70. Configuring Spring with Groovy 2 • Configuring and implementing Spring-style applications using Groovy 2.x • Groovy-based bean definitions • Groovy as the language of choice for an entire application, as a direct and straightforward alternative to Java source files • Groovy 2.0's static compilation support completes the picture here 70
  • 71. Support for Key Java EE 7 Technologies • JMS 2.0 • JPA 2.1 • Bean Validation 1.1 • Servlet 3.1 • And fully covering JCache 1.0 71
  • 72. Enabling WebSocket-style Architectures • Support for JSR-356 compliant runtimes • Also supporting related technologies 72
  • 73. Fine-grained Eventing and Messaging • Introducing fine-grained eventing and messaging within the application • Building on our existing application event mechanism • Aligned with our JMS message listener mechanism 73
  • 74. Pruning and Dependency Upgrades • Removing a variety of deprecated packages across the framework – See Spring Framework 3.2's deprecations! • Raising minimum dependencies to Java 6+ – Java SE 6+ and Java EE 6+ – with some compromises for EE 5++ servers 74
  • 76. Special Thanks to… • Juergen Hoeller • Chris Beams • Rossen Stoyanchev … for permitting reuse of some of their content in this presentation! 76
  • 77. Further Resources • Spring Framework – http://www.springsource.org/spring-framework – Spring Reference Manual – Javadoc • Spring Forums – http://forum.springframework.org • Spring JIRA – http://jira.springframework.org • Spring on GitHub – https://github.com/SpringSource/spring-framework 77
  • 78. Blogs • SpringSource Team Blog – http://blog.springsource.com/ • Swiftmind Team Blog – http://www.swiftmind.com/blog/ 78