Struct composition not supported #35
Unanswered
gsginzburg
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It seems like a struct composition is not supported, which makes this not very usable. For instance:
type StructA struct {
SomeBeanA *SomeBeanA
di.inject:""
}
type StructB struct {
StructA
SomeBeanB *SomeBeanB
di.inject:""
}
func main() {
di.RegisterBean("beanA", reflect.TypeOf((*SomeBeanA)(nil)))
di.RegisterBean("beanB", reflect.TypeOf((*SomeBeanB)(nil)))
di.InitializeContainer()
}
when StructB gets initialized, StructA gets ignored. It should, however, recurse into StructA, as it would in Spring. Is there a solution for this that I am missing?
Thanks,
Gary
Beta Was this translation helpful? Give feedback.
All reactions