kataras / kataras/iris

dependency question

Open
#2,157 2 comments 0 reactions 0 assignees View on GitHub
🤔 type:question
Dominant language
Go
Stars
25.6k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

when i use RegisterDependency to implements singleton bean

```
func main(){
IrisApp = iris.New()
IrisApp.RegisterDependency(NewService)
party:=IrisApp.Party("/test")
irisMvc := mvc.New(party)
irisMvc.handle(new(controller))
}

func NewService(){
return &Test{name:"kangkang"}
}
type Test struct{
name string
}

type controller struct{
test Test
}

func (c *controller)Get(){
fmt.Println(&c.test)
}
```

myquestion is that does the c.test is singleton? not new every time

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.