# Generating an OpenAPI document and SDK from Spring Boot
Source: https://speakeasy.com/openapi/frameworks/springboot

import { Callout } from "@/mdx/components";



You have a Spring Boot API and need to generate SDKs or API documentation for other teams. Rather than writing and maintaining separate OpenAPI documents, we will walk through how to generate them directly from your Spring Boot code and then use them to create and customize an SDK.

We'll work with real code you can run locally, building a simple bookstore API to demonstrate how to properly document API structures, including inheritance between models, endpoint definitions, response types, and error handling. The examples illustrate how Spring Boot annotations map to OpenAPI concepts, so you can see how your code translates into API specifications.

<Callout title="Example repository" type="info">
  The example below will guide you through the process of creating a Spring Boot
  project, adding the necessary dependencies, writing Spring Boot controllers
  with OpenAPI annotations, and generating an OpenAPI document from it. To skip
  this setup and follow along with our example, clone the [example
  application](https://github.com/speakeasy-api/examples/tree/main/framework-springboot).
  The example uses Java 21.
</Callout>

## Setting up a Spring Boot project

First, create a new Spring Boot project using [Spring Initializr](https://start.spring.io/). Select the following options:

- Project: Maven
- Language: Java
- Spring Boot: 3.5.x (or the latest stable version)
- Project Metadata: Fill in as appropriate
- Dependencies: Spring Web

Download the project and extract it to your preferred directory.

## Adding OpenAPI dependencies

Open the `pom.xml` file and add the following dependency:

```xml filename="pom.xml"
<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
    <version>2.8.8</version>
</dependency>
```

## Configuring application properties

Open the `src/main/resources/application.properties` file and add the following configuration:

```properties filename="application.properties"