back to all blogsSee all blog posts

Spring Boot 3 support in Open Liberty 23.0.0.8-beta

image of author
Michal Broz on Aug 3, 2023
Post available in languages:

Open Liberty 23.0.0.8-beta introduces support for Spring Boot 3, so you can use Spring Boot 3.x function in your Liberty applications. This beta release also includes the very early preview of Jakarta Data.

The Open Liberty 23.0.0.8-beta includes the following beta features (along with all GA features):

Spring Boot 3.0 support

The Liberty Spring Boot Support 3.0 feature provides more complete support for running a Spring Boot 3.0 application on Liberty. It also provides the capability to "thin" the application when you create applications in containers.

Prior releases of Liberty provided support for Spring Boot 1.5 and Spring Boot 2.0 applications. Liberty has also supported Spring Boot applications packaged as a WAR file, as demonstrated in this recent blog post. The Open Liberty 23.0.0.8-beta release enables you to deploy Spring Boot 3.x applications by enabling the springboot-3.0 feature, with support for both JAR and WAR file types.

To run a Spring Boot 3.x application on Liberty, you must be running with Java 17 or higher. Additionally, if your application uses the Jakarta Servlet feature, it must be Jakarta Servet 6.0. Configure these features in the server.xml file, as shown in the following example:

<features>
   <feature>springboot-3.0</feature>
   <feature>servlet-6.0</feature>
</features>

As with previous versions of the Spring Boot Support feature, Spring Boot application JAR files can be placed in the /dropins/spring/ directory. Alternatively, specify the Spring Boot configuration elements in the server.xml file. For example:

 <springBootApplication id="spring-boot-app" location="spring-boot-app-0.1.0.jar" name="spring-boot-app" />

If you have used previous versions of the Spring Boot Support feature and are now migrating your application to use Spring Boot 3, note the following requirements:

Early preview of Jakarta Data

The 23.0.0.8-beta release also includes a preview of Jakarta Data. More information is available in the Jakarta Data beta 2 update in Open Liberty 23.0.0.7-beta blog post.

Try it now

To try out these features, update your build tools to pull the Open Liberty All Beta Features package instead of the main release. The beta works with Java SE 20, Java SE 17, Java SE 11, and Java SE 8.

If you’re using Maven, add the All Beta Features package to your pom.xml file:

<plugin>
    <groupId>io.openliberty.tools</groupId>
    <artifactId>liberty-maven-plugin</artifactId>
    <version>RELEASE</version>
    <configuration>
        <runtimeArtifact>
          <groupId>io.openliberty.beta</groupId>
          <artifactId>openliberty-runtime</artifactId>
          <version>23.0.0.8-beta</version>
          <type>zip</type>
        </runtimeArtifact>
    </configuration>
</plugin>

You must also add dependencies to your pom.xml file for the beta version of the APIs that are associated with the beta features that you want to try. For example, for Jakarta Data Beta 2, you would include:

<dependency>
  <groupId>jakarta.data</groupId>
  <artifactId>jakarta-data-api</artifactId>
  <version>1.0.0-b2</version>
</dependency>

Or for Gradle:

dependencies {
    libertyRuntime group: 'io.openliberty.beta', name: 'openliberty-runtime', version: '[23.0.0.8-beta,)'
}

Or if you’re using container images:

FROM icr.io/appcafe/open-liberty:beta

Or take a look at our Downloads page.

For more information on using a beta release, refer to the Installing Open Liberty beta releases documentation.

We welcome your feedback

Let us know what you think on our mailing list. If you hit a problem, post a question on StackOverflow. If you hit a bug, please raise an issue.