-
Notifications
You must be signed in to change notification settings - Fork 39
Spring Boot
morfeusys edited this page Mar 31, 2020
·
3 revisions
Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run". It allows you to serve your JAICF agents as a HTTP servlets.
This server can be used with any channel that implements HttpBotChannel interface.
Learn more about channels here.
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.3.61"
kotlin("plugin.spring") version "1.3.61"
id("org.springframework.boot") version "2.2.2.RELEASE"
id("io.spring.dependency-management") version "1.0.8.RELEASE"
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "1.8"
}
}
Use HttpBotChannelServlet for HttpBotChannel endpoints.
Here is an example of Amazon Alexa channel configuration:
@Configuration
class Context {
@WebServlet("/")
class AlexaController: HttpBotChannelServlet(
AlexaChannel(helloWorldBot)
)
}
And then start a server:
fun main(args: Array<String>) {
runApplication<BlogApplication>(*args) {
setBannerMode(Banner.Mode.OFF)
}
}