For the latest stable version, please use Spring Framework 6.2.0!spring-doc.cn

Classes and Interfaces

The Spring Framework supports various Kotlin constructs, such as instantiating Kotlin classes through primary constructors, immutable classes data binding, and function optional parameters with default values.spring-doc.cn

Kotlin parameter names are recognized through a dedicated KotlinReflectionParameterNameDiscoverer, which allows finding interface method parameter names without requiring the Java 8 -parameters compiler flag to be enabled during compilation. (For completeness, we nevertheless recommend running the Kotlin compiler with its -java-parameters flag for standard Java parameter exposure.)spring-doc.cn

You can declare configuration classes as top level or nested but not inner, since the later requires a reference to the outer class.spring-doc.cn