package rest //@Service type DashboardService struct { Bean dashboardDao *DashboardDao userDao *UserDao } //初始化方法 func (this *DashboardService) Init() { this.Bean.Init() //手动装填本实例的Bean. 这里必须要用中间变量方可。 b := CONTEXT.GetBean(this.dashboardDao) if b, ok := b.(*DashboardDao); ok { this.dashboardDao = b } b = CONTEXT.GetBean(this.userDao) if b, ok := b.(*UserDao); ok { this.userDao = b } }