https://docs.spring.io/spring-framework/docs/current/reference/html/core.html#beans-some-examples

kotlin changed to:

class ExampleBean private constructor() {
    companion object {
        // a static factory method; the arguments to this method can be
        // considered the dependencies of the bean that is returned,
        // regardless of how those arguments are actually used.
        @JvmStatic
        fun createInstance(anotherBean: AnotherBean, yetAnotherBean: YetAnotherBean, i: Int): ExampleBean {
            val eb = ExampleBean (...)
            // some other operations...
            return eb
        }
    }
}

Comment From: sbrannen

Thanks for pointing this out.

This has been addressed in 5.3.x and main.

In the future, when you come across issues like this with the documentation feel free to submit a PR that contains the fix.