From cd3b487fa8398a3a1f4c55de87b39f4444fb3e2d Mon Sep 17 00:00:00 2001 From: zicla Date: Sun, 28 Apr 2019 00:44:43 +0800 Subject: [PATCH] Fix the order error of context. --- code/rest/context.go | 3 ++- main.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/code/rest/context.go b/code/rest/context.go index 93c04f6..0a36219 100644 --- a/code/rest/context.go +++ b/code/rest/context.go @@ -195,7 +195,8 @@ func (this *Context) GetBean(bean core.IBean) core.IBean { //初始化每个Bean func (this *Context) initBeans() { - for _, bean := range this.BeanMap { + for key, bean := range this.BeanMap { + core.LOGGER.Info("init %s", key) bean.Init() } } diff --git a/main.go b/main.go index c8fc965..96593d4 100644 --- a/main.go +++ b/main.go @@ -15,18 +15,18 @@ func main() { //日志第一优先级保障 tankLogger := &support.TankLogger{} + core.LOGGER = tankLogger tankLogger.Init() defer tankLogger.Destroy() - core.LOGGER = tankLogger //装载配置文件,这个决定了是否需要执行安装过程 config.CONFIG.Init() //全局运行的上下文 tankContext := &rest.Context{} + core.CONTEXT = tankContext tankContext.Init() defer tankContext.Destroy() - core.CONTEXT = tankContext http.Handle("/", core.CONTEXT)