bug fixed
This commit is contained in:
parent
2af6adb2ae
commit
880b90003d
|
@ -140,7 +140,13 @@ func splitAnnotationAttribute(s string) (map[string]string, error) {
|
|||
aas := strings.Index(ts[as:], AnnotationAttributeStartChar)
|
||||
aae := strings.Index(ts[as+aas+1:], AnnotationAttributeEndChar)
|
||||
|
||||
ss[aName] = ts[as+aas+1 : as+aas+aae+1]
|
||||
if -1 == aas && -1 == aae {
|
||||
ss[aName] = ts[as+1 : len(ts)]
|
||||
} else if -1 != aas && -1 != aae {
|
||||
ss[aName] = ts[as+aas+1 : as+aas+aae+1]
|
||||
} else {
|
||||
return nil, fmt.Errorf("not valid string %s", ts)
|
||||
}
|
||||
|
||||
asi := strings.Index(ts[as+aae:], AnnotationAttributeSpliter)
|
||||
if -1 == asi {
|
||||
|
|
|
@ -17,8 +17,8 @@ func init() {
|
|||
|
||||
type ComponentAnnotation struct {
|
||||
cda.TypeAnnotation `@annotation:"@Component"`
|
||||
Name string `@annotation:"name"`
|
||||
InitMethod string `@annotation:"initMethod"` // func (receiver interface{}, cr ComponentRegistry) error
|
||||
DestroyMethod string `@annotation:"destroyMethod"` // func (receiver interface{}, cr ComponentRegistry) error
|
||||
Scope di.ScopeType `@annotation:"scope"`
|
||||
Name string `json:"name"`
|
||||
InitMethod string `json:"initMethod"` // func (receiver interface{}, cr ComponentRegistry) error
|
||||
DestroyMethod string `json:"destroyMethod"` // func (receiver interface{}, cr ComponentRegistry) error
|
||||
Scope di.ScopeType `json:"scope"`
|
||||
}
|
||||
|
|
|
@ -16,5 +16,6 @@ func init() {
|
|||
|
||||
type InjectAnnotation struct {
|
||||
cda.TypeAnnotation `@annotation:"@Inject"`
|
||||
Name string `@annotation:"name"`
|
||||
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
|
|
@ -14,5 +14,5 @@ func init() {
|
|||
|
||||
type ResourceAnnotation struct {
|
||||
cda.TypeAnnotation `@annotation:"@Resource"`
|
||||
Name string `@annotation:"name"`
|
||||
Name string `:"name"`
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ func RegisterType(t reflect.Type) {
|
|||
|
||||
registry.RegisterType(t)
|
||||
}
|
||||
|
||||
func (cr *defaultComponentRegistry) RegisterType(t reflect.Type) {
|
||||
if nil == t {
|
||||
log.Panicf("DI: t[reflect.Type] is nil")
|
||||
|
|
Loading…
Reference in New Issue
Block a user