10000 继承的struct无法完成父struct的依赖注入 · Issue #167 · alibaba/IOC-golang · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
继承的struct无法完成父struct的依赖注入 #167
Open
@535727234

Description

@535727234

以下代码GetApp2Singleton()后,访问父struct的ServiceImpl1会报空指针,错误panic: runtime error: invalid memory address or nil pointer dereference

// +ioc:autowire=true
// +ioc:autowire:type=singleton
type App struct {
ServiceImpl1 Service singleton:"main.ServiceImpl1"
ServiceImpl2 Service singleton:"main.ServiceImpl2"
}
// +ioc:autowire=true
// +ioc:autowire:type=singleton
type App2 struct {
App
ServiceStruct *ServiceStruct singleton:""
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0