<commit_before>---
type: tutorial
layout: tutorial
title:  "Creating a RESTful Web Service with Spring Boot"
description: "This tutorial walks us through the process of creating a simple REST controller with Spring Boot"
authors: <NAME>, <NAME>, <NAME>
showAuthorInfo: true
source: spring-boot-restful
---
Kotlin works quite smoothly with Spring Boot and many of the steps found on the [Spring Guides](https://spring.io/guides) for creating a RESTful service
can be followed verbatim for Kotlin. There are some minor differences however when it comes to defining the Gradle configuration
and the project layout structure, as well as the initialization code.

In this tutorial we'll walk through the steps required. For a more thorough explanation of Spring Boot and RESTful services, please see
[Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/).

Note that all classes in this tutorial are in the `org.jetbrains.kotlin.demo` package.

### Defining the project and dependencies
{{ site.text_using_gradle }}

The Gradle file is pretty much standard for Spring Boot. The only differences are the structure layout for source folders for Kotlin, the required Kotlin dependencies and the [*kotlin-spring*](https://kotlinlang.org/docs/reference/compiler-plugins.html#kotlin-spring-compiler-plugi) Gradle plugin (CGLIB proxies used for example for `@Configuration` and `@Bean` processing require `open` classes).

<div class="sample" markdown="1" theme="idea" mode="groovy" data-highlight-only>
``` groovy
buildscript {
    ext.kotlin_version = '{{ site.data.releases.latest.version }}' // Required for Kotlin integration<commit_msg>fix(tutorial): add a link to the official Spring + Kotlin tutorial<commit_after>---
type: tutorial
layout: tutorial
title:  "Creating a RESTful Web Service with Spring Boot"
description: "This tutorial walks us through the process of creating a simple REST controller with Spring Boot"
authors: <NAME>, <NAME>, <NAME>
showAuthorInfo: true
source: spring-boot-restful
---
Kotlin works quite smoothly with Spring Boot and many of the steps found on the [Spring Guides](https://spring.io/guides) for creating a RESTful service
can be followed verbatim for Kotlin. There are some minor differences however when it comes to defining the Gradle configuration
and the project layout structure, as well as the initialization code.

In this tutorial we'll walk through the steps required. For a more thorough explanation of Spring Boot and Kotlin, please see
[Building web applications with Spring Boot and Kotlin](https://spring.io/guides/tutorials/spring-boot-kotlin/).

Note that all classes in this tutorial are in the `org.jetbrains.kotlin.demo` package.

### Defining the project and dependencies
{{ site.text_using_gradle }}

The Gradle file is pretty much standard for Spring Boot. The only differences are the structure layout for source folders for Kotlin, the required Kotlin dependencies and the [*kotlin-spring*](https://kotlinlang.org/docs/reference/compiler-plugins.html#kotlin-spring-compiler-plugi) Gradle plugin (CGLIB proxies used for example for `@Configuration` and `@Bean` processing require `open` classes).

<div class="sample" markdown="1" theme="idea" mode="groovy" data-highlight-only>
``` groovy
buildscript {
    ext.kotlin_version = '{{ site.data.releases.latest.version }}' // Required for Kotlin integration
{'fraction_non_alphanumeric': 0.08429458740017746, 'fraction_numerical': 0.0005915409642117716, 'mean_word_length': 5.194139194139194, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3859753', 'n_tokens_mistral': 914, 'n_tokens_neox': 860, 'n_words': 400}