Skip to content

Spring Fu is an incubator for new Spring features about Kotlin and functional bean registration. It introduces Kofu and Jafu configuration for configuring Spring Boot in a functional way, Coroutines support, GraalVM native images support and various other features.

License

Notifications You must be signed in to change notification settings

melbjvm/spring-fu

 
 

Repository files navigation

Spring Fu

Build Status

Spring Fu is an incubator for new Spring features about Kotlin and functional bean registration. Its main feature is an alternative way of configuring Spring Boot applications with Kotlin DSL and lambdas instead of annotations: Kofu (for Kotlin and functional) configuration. Other features like Coroutines or GraalVM support are also included.

A Java variant called Jafu (for Java and functional) is also available (just a POC for now).

It is not intended to be used in production, but rather to incubate and get feedback and contributions from the community in order to reach a point where its features can be integrated as part of existing Spring projects like Framework, Boot and Data. The table bellow summarize the status of current features.

Status

Feature Status Related issue

Kofu and Jafu configuration DSL

Incubating in Spring Fu

Slightly related: spring-boot#8115 To be created in Spring Boot issue tracker

More efficient Spring Boot startup via functional bean registration

Manually created in Spring Fu

Could be generated during Spring Boot build in the future

To be created in Spring Boot issue tracker

Incubating in Spring Fu

SPR-15413 kotlinx.coroutines#254 kotlinx.coroutines#284 To be created in Spring Data issue tracker for MongoDB and SQL support

Data classes support for configuration properties

Expected in Spring Boot 2.2 (to be confirmed)

Initial support done in Spring Framework 5.1

Work in progress on GraalVM side

Better Kotlin documentation

Not started yet

Pull-request to be contributed

Incubating in Spring Fu

Not started yet

Not started yet

Getting started

Via start.spring.io

  • Create a Spring 2.1.x.RELEASE project on start.spring.io,

  • Add the org.springframework.fu:spring-fu-kofu:0.0.3.BUILD-SNAPSHOT dependency

  • Add the Reactive Web org.springframework.boot:spring-boot-starter-webflux dependency

  • Use latest Kotlin 1.3.x

  • Modify the generated *Application.kt file as following:

package com.example

import org.springframework.fu.kofu.application

val app = application {
	// your application here
	server {
		router {
			GET("/") { ok().syncBody("Hello world!") }
		}
	}
}

fun main() = app.run()

Samples

You can also have a look to the sample applications.

Credits

In addition to the whole Spring and Reactor teams, special credits to:

About

Spring Fu is an incubator for new Spring features about Kotlin and functional bean registration. It introduces Kofu and Jafu configuration for configuring Spring Boot in a functional way, Coroutines support, GraalVM native images support and various other features.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 79.7%
  • Java 20.2%
  • Other 0.1%