Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Migrating from Spring 3 to Spring 4 
By Phillip Verheyden 
@phillipuniverse 
© 2014 SpringOne 2GX. All rights reserved. Do...
About Me 
• Phillip Verheyden 
• @phillipuniverse 
(GitHub, Twitter, et al.) 
• I code @broadleaf 
2
3
Do you use Spring? 
Is eCommerce your business? 
Want to ride with us on the future-train of Java eCommerce? 
! 
Then use ...
This Talk 
• Upgrades in general 
• Spring 4 specifically 
• Dependencies 
• Taking advantage of new (-ish) features 
• Ja...
6
Why should you invest in a upgrade/migration? 
• Talent acquisition/retention 
• “Nobody ever got fired for choosing…” 
• ...
8 
A balancing act
Spring 4 
9
10
How we did it 
• First pass - initial update for compilation 
• Pass++ 
• Java-based configuration, resource handling 
11
Before you update 
• Regression tests 
• Unit Tests 
• Integration tests 
• Functional tests 
12
What does the upgrade path look like? 
• Migration guide on GitHub 
• Skip 4.0.6.RELEASE, go directly to 4.1.0.RELEASE 
• ...
Dependent Libraries 
14
Spring 4 recommended minimum versions 
• In general, versions released in 2010 and later 
• Full list 
• Spring IO Platfor...
Spring 4 recommended minimum versions 
• Servers 
• Tomcat 6.0.33 / 7.0.20 
• Jetty 7.5 
• JBOSS AS 6.1 
• GlassFish 3.1 (...
Jackson 
• Jackson 1.x to 2.x 
• Maintainer change from Codehaus to FasterXML 
• Java package change from org.codehaus.jac...
Jackson 
• JAXRS 
! 
! 
! 
! 
! 
! 
! 
• JAXB annotations, Jackson serialization 
18
XSD Updates 
• If you are utilizing the Spring XML namespaces, you should 
update these to target the -4.1.xsd 
• Or use t...
What should you be using right now? 
20
What can you immediately use in Spring 4? 
• Lots of topics already covered (Java 8, sockets, resource 
handling) 
• Java ...
Demo 
22
Demo Components 
• Java configuration (Servlet + Spring) 
• Add web socket support 
23
What have we learned? 
24
What did we learn 
• Upgrading == good 
• You don’t need to do a huge re-platform (good backwards 
compatibility) 
• Tiere...
26
Upcoming SlideShare
Loading in …5
×

Migrating to Spring 4 from Spring 3 - What you need to know

17,038 views

Published on

Speaker:Phillip Verheyden
Applied Spring Track

In this talk we will cover what it takes to migrate a Spring 3.x application to Spring 4. Some of the questions that we will answer:

What improvements does Spring 4 offer over Spring 3 and why should I invest in upgrading?
What do I do with all of my current XML configuration?
What about dependent library upgrades like Hibernate and Jackson?

Part of this talk will focus on updating a specific application based on Spring 3 up to date with Spring 4 and the latest in best practices and design.

Published in: Software

Migrating to Spring 4 from Spring 3 - What you need to know

  1. 1. Migrating from Spring 3 to Spring 4 By Phillip Verheyden @phillipuniverse © 2014 SpringOne 2GX. All rights reserved. Do not distribute without permission.
  2. 2. About Me • Phillip Verheyden • @phillipuniverse (GitHub, Twitter, et al.) • I code @broadleaf 2
  3. 3. 3
  4. 4. Do you use Spring? Is eCommerce your business? Want to ride with us on the future-train of Java eCommerce? ! Then use Broadleaf! https://github.com/BroadleafCommerce http://demo.broadleafcommerce.com http://www.broadleafcommerce.com 4
  5. 5. This Talk • Upgrades in general • Spring 4 specifically • Dependencies • Taking advantage of new (-ish) features • Java configuration • Web Sockets 5
  6. 6. 6
  7. 7. Why should you invest in a upgrade/migration? • Talent acquisition/retention • “Nobody ever got fired for choosing…” • Stagnation/debt • Code you no longer have to support • Supported versions • Who is still on Java 6? (IBM?) • New features • Programming == fun (?) • Feature enablement++ (see Web Sockets, Lambdas) 7
  8. 8. 8 A balancing act
  9. 9. Spring 4 9
  10. 10. 10
  11. 11. How we did it • First pass - initial update for compilation • Pass++ • Java-based configuration, resource handling 11
  12. 12. Before you update • Regression tests • Unit Tests • Integration tests • Functional tests 12
  13. 13. What does the upgrade path look like? • Migration guide on GitHub • Skip 4.0.6.RELEASE, go directly to 4.1.0.RELEASE • TL;DR - it’s not that bad 13
  14. 14. Dependent Libraries 14
  15. 15. Spring 4 recommended minimum versions • In general, versions released in 2010 and later • Full list • Spring IO Platform • JPA 2.0 • Jackson 2 - no Jackson 1 support in Spring 4.1 • Hibernate 3.6 - Hibernate 4 recommended • Servlet 3.0 - Servlet 2.5 still deployable with excluded features • Required for Spring MVC tests • Spring Security 3.2 • Thymeleaf - specific Spring 4 package 15
  16. 16. Spring 4 recommended minimum versions • Servers • Tomcat 6.0.33 / 7.0.20 • Jetty 7.5 • JBOSS AS 6.1 • GlassFish 3.1 (with a workaround) • Oracle WebLogic 10.3.4 (with JPA 2.0) • IBM WebSphere 7.0.0.9 (with JPA 2.0) 16
  17. 17. Jackson • Jackson 1.x to 2.x • Maintainer change from Codehaus to FasterXML • Java package change from org.codehaus.jackson to com.fasterxml.jackson.core • Want to use JAXRS? • Add jackson-jaxrs-json-provider • Want to use JAXB annotations with Jackson serialization? Add jackson-module-jaxb-annotations Transitively includes jackson-annotations and jackson-core 17
  18. 18. Jackson • JAXRS ! ! ! ! ! ! ! • JAXB annotations, Jackson serialization 18
  19. 19. XSD Updates • If you are utilizing the Spring XML namespaces, you should update these to target the -4.1.xsd • Or use the version-less version 19
  20. 20. What should you be using right now? 20
  21. 21. What can you immediately use in Spring 4? • Lots of topics already covered (Java 8, sockets, resource handling) • Java config (now is a great time to start using it) • Spring Security 3.2 • Auto CSRF protection • Better Java config • @RestController • Ordered list bean injection • Generic injection (e.g. @Autowired Repository<Order>) • Spring MVC test framework 21 $('');
  22. 22. Demo 22
  23. 23. Demo Components • Java configuration (Servlet + Spring) • Add web socket support 23
  24. 24. What have we learned? 24
  25. 25. What did we learn • Upgrading == good • You don’t need to do a huge re-platform (good backwards compatibility) • Tiered feature upgrade might be the best option • Java config - now with more standard Java extension patterns • Simple real-world web socket support is sick! 25
  26. 26. 26

×