bug fixed
This commit is contained in:
parent
29086dfa02
commit
6da88d5c84
|
@ -6,16 +6,34 @@ import (
|
||||||
|
|
||||||
cdr "git.loafle.net/commons/di-go/registry"
|
cdr "git.loafle.net/commons/di-go/registry"
|
||||||
|
|
||||||
annotation "git.loafle.net/totopia/server/pkg/loafer/app/annotation"
|
appAnnotation "git.loafle.net/totopia/server/pkg/loafer/app/annotation"
|
||||||
|
webAnnotation "git.loafle.net/totopia/server/pkg/loafer/web/annotation"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Run(t reflect.Type) {
|
func Run(t reflect.Type) {
|
||||||
ta := cdr.GetTypeAnnotation(t, annotation.ServerAnnotationType)
|
taServer := cdr.GetTypeAnnotation(t, appAnnotation.ServerAnnotationType)
|
||||||
if nil == ta {
|
if nil == taServer {
|
||||||
log.Printf("[%s] is not Server, use @app:Server", t.Elem().Name())
|
log.Printf("[%s] is not Server, use @app:Server", t.Elem().Name())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
vta := ta.(*annotation.ServerAnnotation)
|
aServer := taServer.(*appAnnotation.ServerAnnotation)
|
||||||
log.Printf("%s %d", t.Elem().Name(), vta.HTTPPort)
|
log.Printf("%s %d", t.Elem().Name(), aServer.HTTPPort)
|
||||||
|
|
||||||
|
restHandlers, err := cdr.GetInstancesByAnnotationType(webAnnotation.RestHandlerAnnotationType)
|
||||||
|
if nil != err {
|
||||||
|
log.Printf("[%v]", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, restHandler := range restHandlers {
|
||||||
|
t := reflect.TypeOf(restHandler)
|
||||||
|
ta := cdr.GetTypeAnnotation(t, webAnnotation.RestHandlerAnnotationType)
|
||||||
|
if nil == ta {
|
||||||
|
log.Printf("Service[%s] is not RESTService, use @RESTService", t.Elem().Name())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log.Printf("%s %v", t.Elem().Name(), ta)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,9 @@ import (
|
||||||
|
|
||||||
// For annotation
|
// For annotation
|
||||||
_ "git.loafle.net/totopia/server/pkg/loafer/app/annotation"
|
_ "git.loafle.net/totopia/server/pkg/loafer/app/annotation"
|
||||||
|
|
||||||
|
// For user
|
||||||
|
_ "git.loafle.net/totopia/server/pkg/modules/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ServerType = reflect.TypeOf((*Server)(nil))
|
var ServerType = reflect.TypeOf((*Server)(nil))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user