A Renewal
After the short days, cold temperatures, and barren flora of winter comes the season of spring: a rebirth of the world, with the days getting longer, the weather getting warmer, and the flowers and trees blooming once again. It’s hard not to have a brighter disposition or a greater bounce in one’s step as nature’s vitality – which was given a farewell in the prior autumn – returns anew. It was fitting, then, to celebrate this past May the return of the return of Spring I/O to Barcelona after the “winter” of the inability to hold the conference in-person for the past two years due to COVID. What a return it was! A full attendance, lots of presentations and workshops, great food… it was like things hadn’t changed.
Background
So what is Spring I/O? It’s a yearly two-day conference held in Barcelona (at the foot of Montjuïc and the Magic Fountain) for the Spring Framework, an immensely-popular application framework for the JVM ecosystem (on which the Spring Boot framework is based). As mentioned earlier, the conference is full of presentations by people from all across the software development industry as well as several workshops designed to help gain knowledge on how to accomplish various tasks (e.g. setting up Spring on Kubernetes) in a hands-on manner. Also present, of course, are the attendees from a multitude of companies and countries, and there is no lack of opportunities for networking.
Highlights
Thymeleaf
While the web development world has seen the introduction of various front-end frameworks like React, Angular, and Vue, traditional server-side rendering remains far from extinguished. Thymeleaf continues to grow as a templating engine for Java and an alternative choice for when full-blown front-end Javascript frameworks would be overkill for project requirements along with benefits like easier SEO (due to the web content being readily available) and caching/deep-linking being available by default. When even more browser functionality capabilities are necessary, the HTMX library is available as a supplement to access this functionality within HTML tags instead of generating additional Javascript code. On top of this is a small library in active development that facilitates integration between Thymeleaf/HTMX and Spring Boot. Of course, not all use cases are going to be the best fit for this tech stack – take a look at this page for a breakdown of which use cases might be a better fit for Thymeleaf versus other frameworks.
Testing
JUnit 5.8 – released in September of last year – provided a variety of new features and improvements, such as using the @TempDir annotation to create multiple directories or support for objects that implement AutoCloseable when running tests annotated with @ParameterizedTest. Also discussed at the conference was the upcoming release of JUnit 5.9, which will be released later this year. Among the features that will come in JUnit 5.9 are the use of Open Test Reporting format for XML test result output; a configurable cleanup mode for @TempDir; making the test ordering annotation @Order stable; and permitting @MethodSource to accept arguments to resolve test parameters.
Another topic was how to improve the execution time of Spring tests. For example, Spring contains a context cache that allows the framework to reuse a testing environment between tests, thus saving time between executions of different test cases by not having to reload the Spring application. Consequently, situations where a suitable context cannot be used – the use of @DirtiesContext, the test in question requiring a context that is not found in the context cache, the context cache being full and having to expel a context – the system will have to reload the Spring application and make the test execution last longer. Aside from some general tips – refrain from using @SpringBootTest for unit tests, attempt to share test properties where possible, etc – reducing the test run execution time usually requires a case-by-case examination; setting the log level of org.springframework.test.context to TRACE will report context caching statistics.
Looking Forward
Perhaps one of the most useful parts of the conference is the ability to get “an ear to the ground” and acquire an understanding of the direction in which the Spring Framework is headed. In 2018, it was the integration of reactive programming in the Spring Framework; in 2019, it was the acceptance of Kotlin as a first-class citizen within the Spring Framework; this year, it was the numbers “6” and “3”: namely, the introduction of versions 6.0 and 3.0 of the Spring Framework and Spring Boot, respectively, towards the end of this year. These new releases promise improvements towards further integrating the Spring ecosystem in Java’s evolving direction, with features such as:
- Additional module documentation generation for use with JLink.
- Introductory work to accommodate the upcoming Project Loom.
- Support for AOT compilation, either for faster start-up time on its own or for use with GraalVM’s native compilation.
The catch? The baselines for both Java and JakartaEE (JavaEE) will be increased to 17 and 9, respectively. For code bases that are able to maintain these dependencies up-to-date, this won’t be an issue; otherwise, now might be a good time to start planning out a migration plan.
Conclusion
Barcelona is already a wonderful city, a growing tech hub within Europe and a great destination for travel; if you’re a developer within the JVM ecosystem, the Spring I/O conference is yet another reason for coming to the “Ciutat Comtal”. Tickets for 2023 aren’t available yet, but like the previous years’ conferences, the next conference is tentatively scheduled for the last week of May, so mark your calendars, and hope to see you there!