bug fixed

This commit is contained in:
병준 박 2019-11-11 22:52:10 +09:00
parent 2af6adb2ae
commit 880b90003d
5 changed files with 15 additions and 7 deletions

View File

@ -140,7 +140,13 @@ func splitAnnotationAttribute(s string) (map[string]string, error) {
aas := strings.Index(ts[as:], AnnotationAttributeStartChar) aas := strings.Index(ts[as:], AnnotationAttributeStartChar)
aae := strings.Index(ts[as+aas+1:], AnnotationAttributeEndChar) aae := strings.Index(ts[as+aas+1:], AnnotationAttributeEndChar)
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] 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) asi := strings.Index(ts[as+aae:], AnnotationAttributeSpliter)
if -1 == asi { if -1 == asi {

View File

@ -17,8 +17,8 @@ func init() {
type ComponentAnnotation struct { type ComponentAnnotation struct {
cda.TypeAnnotation `@annotation:"@Component"` cda.TypeAnnotation `@annotation:"@Component"`
Name string `@annotation:"name"` Name string `json:"name"`
InitMethod string `@annotation:"initMethod"` // func (receiver interface{}, cr ComponentRegistry) error InitMethod string `json:"initMethod"` // func (receiver interface{}, cr ComponentRegistry) error
DestroyMethod string `@annotation:"destroyMethod"` // func (receiver interface{}, cr ComponentRegistry) error DestroyMethod string `json:"destroyMethod"` // func (receiver interface{}, cr ComponentRegistry) error
Scope di.ScopeType `@annotation:"scope"` Scope di.ScopeType `json:"scope"`
} }

View File

@ -16,5 +16,6 @@ func init() {
type InjectAnnotation struct { type InjectAnnotation struct {
cda.TypeAnnotation `@annotation:"@Inject"` cda.TypeAnnotation `@annotation:"@Inject"`
Name string `@annotation:"name"`
Name string `json:"name"`
} }

View File

@ -14,5 +14,5 @@ func init() {
type ResourceAnnotation struct { type ResourceAnnotation struct {
cda.TypeAnnotation `@annotation:"@Resource"` cda.TypeAnnotation `@annotation:"@Resource"`
Name string `@annotation:"name"` Name string `:"name"`
} }

View File

@ -58,6 +58,7 @@ func RegisterType(t reflect.Type) {
registry.RegisterType(t) registry.RegisterType(t)
} }
func (cr *defaultComponentRegistry) RegisterType(t reflect.Type) { func (cr *defaultComponentRegistry) RegisterType(t reflect.Type) {
if nil == t { if nil == t {
log.Panicf("DI: t[reflect.Type] is nil") log.Panicf("DI: t[reflect.Type] is nil")