Spring
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 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:
settings:
springBoot: enabledMixed projects (containing Java and Kotlin sources simultaneously) are supported.
Examples of Spring Boot projects:
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:
You can customize the greeting with an optional name parameter in the query string, as the following listing shows:
http://localhost:8080/greeting?name=UserThe name parameter value overrides the default value of World and is reflected in the response, as the following listing shows:
Estás leyendo una vista previa.
Inicia sesión para leer el artículo completo. Cualquier cuenta abre 4 artículos gratuitos al mes; el alumnado y el profesorado leen las páginas de su curso sin límite.
Iniciar sesión