Skip to main content

How-To: Use an existing Spring Boot application in the Workbench

🎯context

You already have an existing Spring Boot application which you want to transform to a IBM Industry Solutions Workbench Project to use the benefits of the Workbench.

Description

In this How-To you will find the steps that are needed to embed your existing Spring Boot application into IBM Industry Solutions Workbench by creating a new Workbench project and moving the implementation files to it.
For this use case the stack "Generic Service Java" is recommended.

Preconditions

  • You are fine with Spring Boot (spring-boot-starter-parent) version 2.4.6 as parent.
  • You are using Maven as build automation tool.

Steps

Get ready for Java Generic Service development

  1. Before we start with the project, please have a look into the Product Documentation to learn about the prerequisites that are necessary for Java Generic Service development.

  2. Now please download and install the Maven dependencies that are described here.

Create a new project

  1. Open the Solution Designer and create a new project of type "Generic Service Project (Java Spring Boot)".

  2. Open the new project and create a new pipeline in the CI / CD area. Dependent on your use case please define either a Deploy pipeline or a Release pipeline. Please check the Product Documentation for further information if needed.

  3. After this, please clone the new project repository using Git. You can use the URL of the source code repository in the "Git" panel at the bottom of the Solution Designer.

  4. When you open the cloned project, you can find some pre-generated files in the src folder. Please go through the stubs and delete the ones that are not needed for your use case.

  5. Merge the content of your application.yaml file into the pre-generated one.

  6. Merge the content of your pom.xml file into the pre-generated one. Be aware, that further adoptions might be needed, if you have to use another parent. The default parent has spring-boot-starter-parent in version 2.4.6 as its parent.

Potentially needed adoptions

Depending on your use case, some further adoptions might be helpful for you.

Provide private maven artifacts

If your project is relying on private maven artifacts, then you have to add access to your private maven repository, see here for further details.

Provide additional certificates

If your project is accessing ressources with not yet trusted certificates, then they can be easily added - see here. IBM Industry Solutions Workbench takes care, that they're present in the JVM during runtime.

Base URL of REST APIs

If you are providing a REST API, then the base URL must start with the project acronym.

Use the Workbench Kafka cluster

Easy: Use the generated EventService class. You just have to bring in your topic name. Alternatively, use the EventService as example and use the KafkaTemplate and the KafkaTopicsHelper in your code.

Known limitations

  • Sending and consuming Kafka events of other 'native' IBM Industry Solutions Workbench solutions is not possible, yet.