Add kotlin-functional sample
Related to https://github.com/spring-projects/spring-framework/issues/29211
This commit is contained in:
21
kotlin-functional/build.gradle
Normal file
21
kotlin-functional/build.gradle
Normal file
@@ -0,0 +1,21 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot'
|
||||
id 'org.springframework.aot.smoke-test'
|
||||
id 'org.graalvm.buildtools.native'
|
||||
id 'org.jetbrains.kotlin.jvm'
|
||||
id 'org.jetbrains.kotlin.plugin.spring' version "1.7.10"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
|
||||
implementation("org.springframework.boot:spring-boot-starter")
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
||||
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||
|
||||
aotSmokeTestImplementation(project(":aot-smoke-test-support"))
|
||||
aotSmokeTestImplementation("org.awaitility:awaitility:4.2.0")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.example.functional;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aot.smoketest.support.assertj.AssertableOutput;
|
||||
import org.springframework.aot.smoketest.support.junit.AotSmokeTest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@AotSmokeTest
|
||||
public class FunctionalApplicationAotTests {
|
||||
|
||||
@Test
|
||||
void expectedLoggingIsProduced(AssertableOutput output) {
|
||||
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
|
||||
assertThat(output).hasSingleLineContaining("Hello World");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.example.functional
|
||||
|
||||
import org.springframework.boot.CommandLineRunner
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.runApplication
|
||||
import org.springframework.context.support.beans
|
||||
|
||||
@SpringBootApplication
|
||||
class FunctionalApplication
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
runApplication<FunctionalApplication>(*args) {
|
||||
addInitializers(beans {
|
||||
bean<Foo>()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
class Foo : CommandLineRunner {
|
||||
override fun run(vararg args: String?) {
|
||||
println("Hello world!")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ include "freemarker-webflux"
|
||||
include "freemarker-webmvc"
|
||||
include "hateoas"
|
||||
include "integration"
|
||||
include "kotlin-functional"
|
||||
include "jdbc-h2"
|
||||
include "jdbc-mariadb"
|
||||
include "jdbc-mysql"
|
||||
|
||||
Reference in New Issue
Block a user