Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Kotlin example for dependency injection with static factory method #28589

Closed
maxbiu opened this issue Jun 9, 2022 · 1 comment
Closed
Assignees
Labels
theme: kotlin An issue related to Kotlin support type: documentation A documentation task
Milestone

Comments

@maxbiu
Copy link

maxbiu commented Jun 9, 2022

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
        }
    }
}
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 9, 2022
@sbrannen sbrannen self-assigned this Jun 9, 2022
@sbrannen sbrannen added type: documentation A documentation task theme: kotlin An issue related to Kotlin support and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 9, 2022
@sbrannen sbrannen added this to the 5.3.21 milestone Jun 9, 2022
@sbrannen sbrannen changed the title Fix Kotlin example for Examples of Dependency Injection Fix Kotlin example for dependency injection with static factory method Jun 9, 2022
@sbrannen
Copy link
Member

sbrannen commented Jun 9, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: kotlin An issue related to Kotlin support type: documentation A documentation task
Projects
None yet
Development

No branches or pull requests

3 participants