Chapter 1. Generate the Red Hat Business Optimizer Spring Boot project


Spring Initialzr is a web-based application that creates a Spring Boot structure based on a few user inputs. You can use Spring Initializr to easily generate a Maven or Gradle Spring Boot project that you can customize for Red Hat Business Optimizer.

Procedure

  1. Open Spring Initializr in a web browser:

    https://start.spring.io/
  2. Select a project, language, Spring Boot version, and enter project metadata.
  3. Click Add Dependencies and select Spring Web to add the spring-boot-starter-web dependency.
  4. Click GENERATE. Your project ZIP file downloads.
  5. Extract the ZIP file and change directory to your Spring Boot project directory.
  6. Add the Red Hat Business Optimizer dependency (optaplanner-spring-boot-starter). Currently optaplanner-spring-boot-starter is not included in Spring Initializr so you must manually add it to your build file.

    • If you generated a Maven project, add the optaplanner-spring-boot-starter dependency to your project’s pom.xml:

      <dependencyManagement>
          <dependencies>
              <dependency>
                  <groupId>org.optaplanner</groupId>
                  <artifactId>optaplanner-spring-boot-starter</artifactId>
                  <version>{project-version}</version>
              </dependency>
          </dependencies>
      </dependencyManagement>

      The following example shows the optaplanner-spring-boot-starter dependency added to your project’s pom.xml file:

      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          <modelVersion>4.0.0</modelVersion>
          <parent>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-parent</artifactId>
              <version>{version-org-spring-framework-boot}</version>
          </parent>
      
          <groupId>com.example</groupId>
          <artifactId>constraint-solving-ai-optaplanner</artifactId>
          <version>0.1.0-SNAPSHOT</version>
          <name>Constraint Solving AI with Red Hat Business Optimizer</name>
          <description>A Spring Boot Red Hat Business Optimizer example to generate a school timetable.</description>
      
          <properties>
              <java.version>1.8</java.version>
          </properties>
      
          <dependencies>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-web</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.optaplanner</groupId>
                  <artifactId>optaplanner-spring-boot-starter</artifactId>
              </dependency>
      
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-test</artifactId>
                  <scope>test</scope>
                  <exclusions>
                      <exclusion>
                          <groupId>org.junit.vintage</groupId>
                          <artifactId>junit-vintage-engine</artifactId>
                      </exclusion>
                  </exclusions>
              </dependency>
          </dependencies>
      
          <dependencyManagement>
              <dependencies>
                  <dependency>
                      <groupId>org.optaplanner</groupId>
                      <artifactId>optaplanner-spring-boot-starter</artifactId>
                      <version>{project-version}</version>
                  </dependency>
              </dependencies>
          </dependencyManagement>
      
          <build>
              <plugins>
                  <plugin>
                      <groupId>org.springframework.boot</groupId>
                      <artifactId>spring-boot-maven-plugin</artifactId>
                  </plugin>
              </plugins>
          </build>
      
      </project>
    • If you generated a Gradle project, add the optaplanner-spring-boot-starter to your build.gradle file:

      implementation "org.optaplanner:optaplanner-spring-boot-starter:{project-version}"

      The following example shows the optaplanner-spring-boot-starter dependency added to your project’s build.gradle file in a Gradle Java project:

      plugins {
          id "org.springframework.boot" version "{version-org-spring-framework-boot}"
          id "io.spring.dependency-management" version "1.0.9.RELEASE"
          id "java"
      }
      
      group = "com.example"
      version = "0.1.0-SNAPSHOT"
      sourceCompatibility = "1.8"
      
      repositories {
          mavenCentral()
      }
      
      dependencies {
          implementation "org.springframework.boot:spring-boot-starter-web"
          implementation "org.optaplanner:optaplanner-spring-boot-starter:{project-version}"
          testImplementation("org.springframework.boot:spring-boot-starter-test") {
              exclude group: "org.junit.vintage", module: "junit-vintage-engine"
          }
      }
      
      test {
          useJUnitPlatform()
      }
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat Documentation

Legal Notice

Theme

© 2026 Red Hat
Back to top