mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-05 23:40:24 +08:00
feat: 新增简易版ioc
This commit is contained in:
@@ -2,13 +2,15 @@ package application
|
||||
|
||||
import (
|
||||
"mayfly-go/internal/redis/infrastructure/persistence"
|
||||
tagapp "mayfly-go/internal/tag/application"
|
||||
"mayfly-go/pkg/ioc"
|
||||
)
|
||||
|
||||
var (
|
||||
redisApp Redis = newRedisApp(persistence.GetRedisRepo(), tagapp.GetTagTreeApp())
|
||||
)
|
||||
func init() {
|
||||
persistence.Init()
|
||||
|
||||
ioc.Register(new(redisAppImpl), ioc.WithComponentName("RedisApp"))
|
||||
}
|
||||
|
||||
func GetRedisApp() Redis {
|
||||
return redisApp
|
||||
return ioc.Get[Redis]("RedisApp")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user