Reference: Bridges
Installation (Gradle)
dependencies {
implementation(platform("org.http4k:http4k-bom:6.1.0.1"))
// Helidon:
implementation("org.http4k:http4k-bridge-helidon")
// Servlet (Jakarta):
implementation("org.http4k:http4k-bridge-jakarta")
// Ktor:
implementation("org.http4k:http4k-bridge-ktor")
// Micronaut:
implementation("org.http4k:http4k-bridge-micronaut")
// Ratpack:
implementation("org.http4k:http4k-bridge-ratpack")
// Servlet (javax):
implementation("org.http4k:http4k-bridge-servlet")
// Spring:
implementation("org.http4k:http4k-bridge-spring")
// Vertx:
implementation("org.http4k:http4k-bridge-vertx")
}
Bridge modules provide a layer of integration with other web frameworks, allowing http4k applications to be deployed alongside them.
The integration allows teams to incrementally introduce http4k into existing applications, creating a path of migration from other migrations to http4k.
We currently provide bridges for the following frameworks:
- Spring (see migration example)
- Ktor (see migration example)
- Micronaut (see migration example)
- Helidon
- Vertx
- Ratpack
- Servlet (jakarta and javax)
General migration strategy
- Add the bridge module for the framework you are using.
- Create a “fallback”
HttpHandler
as starting point for the migration. - Use the bridge to route requests to the fallback handler when no other routes are found.
- Recreate a particular route in http4k, and remove it from the framework when it is ready.
- Repeat step 4 until all routes are migrated.
- Change the application entry point to serve from the http4k
HttpHandler
rather than the framework. - Remove the bridge module and other usages of the framework.