Creating a Spring Boot application for CloudBees Jenkins X Distribution

Java microservices developers can leverage the opinionated resources and preconfigured components of Spring Boot. This software framework takes the Spring platform and adds preconfigured components, third-party libraries, software packagers, and command-line tools for running specialized scripts.

The aim of Spring Boot is to create Spring-based software such as microservices, which can be deployed using the java command-line runtime or standalone Web Application Resource (WAR) package files. Spring Boot uses Spring as a foundation for development, and enhances it with components that provides faster development and deployment, opinionated configuration and setup to get started developing microservices quickly, and a plugin framework that features Maven and Gradle project support.

Spring Boot and CloudBees Jenkins X Distribution

You can incorporate CloudBees Jenkins X Distribution into your Spring Boot projects in two ways:

  1. By importing existing Spring Boot code using jx import

  2. By creating a Spring Boot application from scratch using jx create spring

Importing existing Spring Boot projects

If you have an Spring Boot project that you want to manage builds using CloudBees Jenkins X Distribution, you can use jx import to commit your code to a Git service such as GitHub, add a Dockerfile to build your Spring Boot project as a Docker image, a pipeline.yaml to your ~/.jx/ directory that manages the development pipeline, and a Helm chart for running as a package in Kubernetes.

  1. Change into your Spring Boot project directory:

    cd acme-springapp/
  2. Run the import from a command-line:

    jx import
  3. The application asks for your Git username (such as acmeuser).

  4. The application asks if you wan to initialize your project in Git.

  5. The application asks you what organization to use for managing builds (for example, acmecorp)

  6. The application asks if you want to name your repository (such as acme-springapp1)

You can now perform builds, commit project code to your newly created Git repository, and CloudBees Jenkins X Distribution will automatically process pull requests and create previews for your applications for testing and validation.

Creating a Spring Boot application

If you are evaluating Spring Boot in your CloudBees Jenkins X Distribution environment and need an application template of a Spring Boot project that is preconfigured with CI/CD pipeline and GitOps promotion, use jx create to make the preconfigured project.

  1. Run the Spring Boot creation via command-line:

    $ jx create spring
  2. The application asks for your Git username (such as acmeuser)

  3. The application lets you choose your Git organization from an available list

  4. The application asks for a repository name, such as acme-springapp1

  5. The application prompts you for the development language for your project (by default, java)

  6. The application prompts you for a group ID (by default, com.example)

  7. The application prompts you for any Spring Boot starters, or dependency descriptors that you can use to make your development smoother and quicker.

    CloudBees recommends at minimum the Actuator and Web dependencies, which you can activate by moving to those checkboxes and hitting the Space Bar to select them.

  8. The application prompts you to initialize Git

Spring Boot projects managed by CloudBees Jenkins X Distribution

The two methods of configuring Spring Boot projects in CloudBees Jenkins X Distribution performs several actions:

  • Create a new Spring Boot application in a local subdirectory

  • Add your source code into a Git repository

  • Create a remote git repository on a git service, such as GitHub

  • Commit your code to the remote Git service

  • Adds default build files to your project:

    • A Dockerfile to build your application as a docker image

    • A pipeline.yaml to implement the CI / CD pipeline

    • A helm chart to run your application inside Kubernetes

  • Registers a webhook (such as on the remote git repository

  • trigger the first pipeline build

You can now use your Git-enabled local project subdirectory to make changes to your Spring Boot application, push those changes to Git, and automatically have CloudBees Jenkins X Distribution build, create previews for testing and validation, and promote your app to production for general usage.

If you have any questions or feedback on the CloudBees Jenkins X Distribution documentation, send them to

Copyright © 2010-2020 CloudBees, Inc.Online version published by CloudBees, Inc. under the Creative Commons Attribution-ShareAlike 4.0 license.CloudBees and CloudBees DevOptics are registered trademarks and CloudBees Core, CloudBees Flow, CloudBees Flow Deploy, CloudBees Flow DevOps Insight, CloudBees Flow DevOps Foresight, CloudBees Flow Release, CloudBees Accelerator, CloudBees Accelerator ElectricInsight, CloudBees Accelerator Electric Make, CloudBees CodeShip, CloudBees Jenkins Enterprise, CloudBees Jenkins Platform, CloudBees Jenkins Operations Center, and DEV@cloud are trademarks of CloudBees, Inc. Most CloudBees products are commonly referred to by their short names — Accelerator, Automation Platform, Flow, Deploy, Foresight, Release, Insight, and eMake — throughout various types of CloudBees product-specific documentation. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Jenkins is a registered trademark of the non-profit Software in the Public Interest organization. Used with permission. See here for more info about the Jenkins project. The registered trademark Jenkins® is used pursuant to a sublicense from the Jenkins project and Software in the Public Interest, Inc. Read more at Apache, Apache Ant, Apache Maven, Ant and Maven are trademarks of The Apache Software Foundation. Used with permission. No endorsement by The Apache Software Foundation is implied by the use of these marks.Other names may be trademarks of their respective owners. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this content, and CloudBees was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this content, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.