Skip to content

Instantly share code, notes, and snippets.

@alphaho
Created November 13, 2019 12:47
Show Gist options
  • Select an option

  • Save alphaho/2a9efc1b735279cdfa714efffa9c2f6f to your computer and use it in GitHub Desktop.

Select an option

Save alphaho/2a9efc1b735279cdfa714efffa9c2f6f to your computer and use it in GitHub Desktop.
integrate http4k into Spring application
@Bean
fun http4kServletRegistrationBean(): ServletRegistrationBean<HttpHandlerServlet> {
val app = routes("/webapi/hello" bind GET to { request: Request ->
Response(OK).body("Hello!")
})
val servlet = app.asServlet()
return ServletRegistrationBean<HttpHandlerServlet>(servlet, "/webapi/*")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment