resource bug fixed

This commit is contained in:
crusader 2018-08-30 15:27:45 +09:00
parent a38788fb7f
commit 35e3b97fb9

View File

@ -168,6 +168,7 @@ func (r *InstanceRegistry) GetInstance(t reflect.Type) (instance interface{}, er
}() }()
var ( var (
a oa.Annotation
fV interface{} fV interface{}
) )
@ -188,13 +189,24 @@ func (r *InstanceRegistry) GetInstance(t reflect.Type) (instance interface{}, er
return return
} }
_, ok = as[annotation.InjectAnnotationType] a, ok = as[annotation.InjectAnnotationType]
if ok { if ok {
if fV, err = r.GetInstance(f.Type()); nil != err { if fV, err = r.GetInstance(f.Type()); nil != err {
return return
} }
} }
a, ok = as[annotation.ResourceAnnotationType]
if ok {
name := a.(*annotation.ResourceAnnotation).Name
if "" == name {
name = n
}
if fV, err = r.GetInstanceByName(name); nil != err {
return
}
}
if nil != err { if nil != err {
return return
} }