Spring Boot Kotlin DSL

Spring Boot Kotlin DSL

提问人:Olgun Kaya 提问时间:6/21/2023 更新时间:6/21/2023 访问量:27

问:

最近我在这个问题中问了一个关于 dsl 配置的问题 Spring Boot 和 Kotlin DSL 配置

经过更多的测试,我发现下面的类不是自动接线的。代理没有连接到它的实际实例来提供服务。userSignInService

bean<AppleUserSignInServiceImpl>(name = "appleUserSignInService")
bean<GoogleUserSignInServiceImpl>(name = "googleUserSignInService")

bean(name="googleSignInStrategy")
        {
                IndividualUserSignIn(
                    ref("googleUserSignInService"),
                    ref("userHibernateDAO"),
                    ref("socialAccountHibernateDAO"),
                    ref("userService"),
                )
        }
----------------------------------------------

open class IndividualUserSignIn constructor(
    userSignInService: UserSignInService,
    userDAO: UserDAO,
    socialAccountDAO: SocialAccountDAO,
    userService: UserService,
) : AbstractUserSignIn(
    userSignInService,
    userDAO,
    socialAccountDAO,
    userService,

----------------------------------------------

abstract class AbstractUserSignIn(
    private val userSignInService: UserSignInService,
    private val userDAO: UserDAO,
    private val socialAccountDAO: SocialAccountDAO,
    private val userService: UserService,
    ....
) {

    @Transactional
    open fun signIn(userSignInRequest: SignInRequest): SignInResult {...}
    
    fun getSignInStrategy(): UserSignInStrategy{ // **(A)**
       return userSignInService.getSignInStrategy()
    }
}

如果像在 Spring Boot 和 Kotlin DSL 配置中那样将这些设置为延迟初始化,那么它似乎正在工作,但自动连线对象不是代理IndividualUserSignIn

弹簧启动 nullpointerexception Kotlin-DSL

评论


答: 暂无答案