Which version of Spring Framework version we should go with

In recent days, I have been discussing with my friends on what is the best Spring Framework should be on in order to get full comprehensive of the powerful of Spring Framework.

I think most of the legacy open source projects on github are still on Spring 5.X.

But if you look at the Spring Framework 6.0 was last year November release.

No matter you are using Spring Tool Suite or IDEA, you can see it was already available as default selection of your new spring boot project wizard.

And Spring Boot 3.0 was based on Spring Framework 6.0

So personally i will highly recommend any new projects that will be started should go with Spring Framework 6.0 and Spring Boot 3.0. Also the legacy projects are using Spring framework 5.X and Spring boot 2.7.X should be considered to migrate to 6.0 and 3.0 as well.

So why should go with Spring Framework 6.0?

1. JDK and Jakarta EE

Fully support JDK 17+ which means it is faster, no more support of JDK 8 or JDK 11. As the primary Java Web Open Source Framework, this is what it will go with in future. Most of the current applications/projects will go with JDK upgrade soon as in my opinion.

Also included Jakarta EE 9+ support, Jakarta EE is the original JAVAEE with the new name only. So if you started to use Spring Framework 6.0, you can see Servlet,JPA APIs packages has changed from javax to jakarta already.


2. Better support newer version of web server

Compatible with Tomcat 10.1, Jetty 11, Undertow 2.3


3. Usage of virtual threads

virtual threads is the JDK 19 new feature, based on the use case scenario, it can be used in Higher concurrency。

If you want to run with this JDK new feature, you can use this as run with virtual threads in Spring Framework 6.0

Anyone interested on this, you can google as Virtual Threads vs Platform Threads. This will give you more ideas on what it is about.


4. Unit Testing

Much more easier ways to mock servlet api as HttpServletRequest, HttpSession etc. You can use the MockHttpServletRequest, MockHttpSession in Spring Framework 6.0.


So Spring Framework 6.0 is the version you should go with now. Not 5.X anymore.

要查看或添加评论,请登录

Caihua Liu的更多文章

  • Java ORM Framework

    Java ORM Framework

    In recent days, I have been discussing with my friends what is the best suitable ORM(Object Relational Mapping)…

    1 条评论
  • SQL VS NOSQL Database

    SQL VS NOSQL Database

    There are always different opinions and choices what you want to choose for you database in your applications…

  • Agile - XP VS Scrum

    Agile - XP VS Scrum

    Development team want to choose Agile Development Methodology from either SCRUM or XP(Extreme Programming) Let us talk…

  • How the Empire of Spring Framework Derived

    How the Empire of Spring Framework Derived

    In recent days, I spoke some of my friends about SpringBoot. We did talk about the Spring IOC(Inversion of…

  • Clean Code-Be a good programmer

    Clean Code-Be a good programmer

    This is a very recommended book called Clean Code: A Handbook of Agile Software Craftsmanship. It is a mandatory book…

  • JSON VS XML

    JSON VS XML

    There is another design question that always in the plate. Should we use json or xml as our data interchange pass…

  • JDK 8 is the past, Now we have JDK 17

    JDK 8 is the past, Now we have JDK 17

    This was the discussion between me and my friends on which is the best JDK version we should use at the moment. Today…

  • The Dynasty iteration of Javascript Frameworks

    The Dynasty iteration of Javascript Frameworks

    What is the most popular Javascript framework in the javascript market. I want go through the original first iteration…

  • How to write code with OOP mindset

    How to write code with OOP mindset

    When we talk about the OOP Design, it is all about how to write your code with OOP mindset. This is very important if…

  • When to use(Git CLI vs GitHub vs Git IDE Plugin)

    When to use(Git CLI vs GitHub vs Git IDE Plugin)

    Git has replaced the SVN and CVS to be the most popular source code version control system in the market from several…

社区洞察