Escriu per cercar…

Spring

Aquesta pàgina encara no s'ha traduït — es mostra en l'idioma original:English

Introduction

The Spring Framework provides first-class support for Kotlin and lets developers write Kotlin applications almost as if the Spring Framework was a native Kotlin framework. Most of the code samples of the reference documentation are provided in Kotlin in addition to Java.

Spring Framework - Kotlin

Spring Boot

Spring Boot is a framework that simplifies the creation of stand-alone, Spring based applications.

Create a new “JVM Application” with Amper

To enable Spring Boot support, add the following to the module.yaml file:

yaml
settings:
    springBoot: enabled

Mixed projects (containing Java and Kotlin sources simultaneously) are supported.

Examples of Spring Boot projects:

Amper - Spring

RESTful Web Service

You will build a service that will accept HTTP GET requests at http://localhost:8080/greeting.

It will respond with a JSON representation of a greeting, as the following listing shows:

json
{"id":1,"content":"Hello, World!"}

You can customize the greeting with an optional name parameter in the query string, as the following listing shows:

http://localhost:8080/greeting?name=User

The name parameter value overrides the default value of World and is reflected in the response, as the following listing shows:

json
{"id":1,"content":"Hello, User!"}

Estàs llegint una vista prèvia.

Inicia sessió per llegir l'article complet. Qualsevol compte obre 4 articles gratuïts al mes; l'alumnat i el professorat llegeixen les pàgines del seu curs sense límit.

Inicia sessió