DEV Community

Cover image for Keeping up with Spring Boot
Hafiz Jaafar
Hafiz Jaafar

Posted on

Keeping up with Spring Boot

Just like my previous post 'GitOps problems', this time I want to summarize the interesting points of an article I have read recently from the Javamagazin (3rd issue of 2024).

Credits to author Michael Simons, who wrote 7 pages about Spring Boot 3 in that magazine.

Image description

Table of contents

Spring Framework 6 + Java 17 => Spring Boot 3

Spring Boot is a framework to implement not only microservices, but also small services and monolithic applications.

Spring Boot is not only the framework for such applications out there. There are also Quarkus and Micronaut, which boast reduction of startup time and resources.

Spring Boot 3, from Spring Framework 6, makes the minimalist Java 17 a mandatory.

One will also come across Jakarta EE, which replaces Java EE (EE stands for Enterprise Edition, in contrast to SE - Standard Edition).

Maven and Gradle for version and dependencies management

Since Spring Boot 3, we can declare a dependency without specifying the version. But, it is also suggested that we use properties section to specify a version.

<properties>
  <foo.bar.version>1.0.0</foo.bar.version>
</properties>

<dependencies>
  <dependency>
    <group>com.foo.bar</group>
    <artifactId>foo.bar</artifactId>
    <version>${foo.bar.version}</version>
  </dependency>
</dependencies>
Enter fullscreen mode Exit fullscreen mode

Gradle is an alternative to Maven. It supports Java, Kotlin, C/C++, Javascript, etc.

Testcontainers and @ServiceConnection

Testcontainers provides lightweight and one-way instances for everything that can be containerized: databases, message brokers, web browsers, etc.

We can specify Testcontainers as a dependency in test scope.
A new annotation @ServiceConnection is used to mark a method as a source of a Testcontainer.

Testcontainer should be useful, especially if we cannot connect to external sources, e.g. a database or message broker that is deployed on a cloud somewhere and only accessible via VPN.

Top comments (0)