Updated Kotlin docs

This commit is contained in:
Oleg Zhurakousky
2018-12-03 14:01:29 +01:00
parent 6a16a44aa0
commit fd2d59c334
2 changed files with 71 additions and 60 deletions

View File

@@ -93,6 +93,9 @@ The above represents Kotlin lambdas configured as Spring beans. The signature of
While mechanics of Kotlin-to-Java mapping are outside of the scope of this documentation, it is important to understand that the While mechanics of Kotlin-to-Java mapping are outside of the scope of this documentation, it is important to understand that the
same rules for signature transformation outlined in "Java 8 function support" section are applied here as well. same rules for signature transformation outlined in "Java 8 function support" section are applied here as well.
To enable Kotlin support all you need is to add `spring-cloud-function-kotlin` module to your classpath which contains the appropriate
autoconfiguration and supporting classes.
== Standalone Web Applications == Standalone Web Applications
The `spring-cloud-function-web` module has autoconfiguration that The `spring-cloud-function-web` module has autoconfiguration that
@@ -110,7 +113,7 @@ plain text and JSON.
|=== |===
| Method | Path | Request | Response | Status | Method | Path | Request | Response | Status
| GET | /{supplier} | - | Items from the named supplier | 200 OK | GET | /{supplier} | - | Items from the named supplier | 200 OK
| POST | /{consumer} | JSON object or text | Mirrors input and pushes request body into consumer | 202 Accepted | POST | /{consumer} | JSON object or text | Mirrors input and pushes request body into consumer | 202 Accepted
| POST | /{consumer} | JSON array or text with new lines | Mirrors input and pushes body into consumer one by one | 202 Accepted | POST | /{consumer} | JSON array or text with new lines | Mirrors input and pushes body into consumer one by one | 202 Accepted
| POST | /{function} | JSON object or text | The result of applying the named function | 200 OK | POST | /{function} | JSON object or text | The result of applying the named function | 200 OK

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?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" <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"> 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> <modelVersion>4.0.0</modelVersion>
@@ -19,6 +20,10 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-context</artifactId> <artifactId>spring-cloud-function-context</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
@@ -29,69 +34,72 @@
<artifactId>spring-boot-configuration-processor</artifactId> <artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<optional>true</optional>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<artifactId>kotlin-maven-plugin</artifactId> <artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId> <groupId>org.jetbrains.kotlin</groupId>
<version>1.2.71</version> <version>1.2.71</version>
<executions> <executions>
<execution> <execution>
<id>compile</id> <id>compile</id>
<goals> <goal>compile</goal> </goals> <goals>
<configuration> <goal>compile</goal>
<sourceDirs> </goals>
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir> <configuration>
<sourceDir>${project.basedir}/src/main/java</sourceDir> <sourceDirs>
</sourceDirs> <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
</configuration> <sourceDir>${project.basedir}/src/main/java</sourceDir>
</execution> </sourceDirs>
<execution> </configuration>
<id>test-compile</id> </execution>
<goals> <goal>test-compile</goal> </goals> <execution>
<configuration> <id>test-compile</id>
<sourceDirs> <goals>
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir> <goal>test-compile</goal>
<sourceDir>${project.basedir}/src/test/java</sourceDir> </goals>
</sourceDirs> <configuration>
</configuration> <sourceDirs>
</execution> <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
</executions> <sourceDir>${project.basedir}/src/test/java</sourceDir>
</plugin> </sourceDirs>
<plugin> </configuration>
<groupId>org.apache.maven.plugins</groupId> </execution>
<artifactId>maven-compiler-plugin</artifactId> </executions>
<version>3.5.1</version> </plugin>
<executions> <plugin>
<!-- Replacing default-compile as it is treated specially by maven --> <groupId>org.apache.maven.plugins</groupId>
<execution> <artifactId>maven-compiler-plugin</artifactId>
<id>default-compile</id> <version>3.5.1</version>
<phase>none</phase> <executions>
</execution> <!-- Replacing default-compile as it is treated specially by maven -->
<!-- Replacing default-testCompile as it is treated specially by maven --> <execution>
<execution> <id>default-compile</id>
<id>default-testCompile</id> <phase>none</phase>
<phase>none</phase> </execution>
</execution> <!-- Replacing default-testCompile as it is treated specially by maven -->
<execution> <execution>
<id>java-compile</id> <id>default-testCompile</id>
<phase>compile</phase> <phase>none</phase>
<goals> <goal>compile</goal> </goals> </execution>
</execution> <execution>
<execution> <id>java-compile</id>
<id>java-test-compile</id> <phase>compile</phase>
<phase>test-compile</phase> <goals>
<goals> <goal>testCompile</goal> </goals> <goal>compile</goal>
</execution> </goals>
</executions> </execution>
</plugin> <execution>
<id>java-test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>