Documentation
¶
Index ¶
- Constants
- type BeanGroupFunc
- type CondContext
- type RefreshState
- type Resolving
- func (c *Resolving) AddMock(mock gs.BeanMock)
- func (c *Resolving) Beans() []*gs_bean.BeanDefinition
- func (c *Resolving) GroupRegister(fn BeanGroupFunc)
- func (c *Resolving) Object(i any) *gs.RegisteredBean
- func (c *Resolving) Provide(ctor any, args ...gs.Arg) *gs.RegisteredBean
- func (c *Resolving) Refresh(p conf.Properties) error
- func (c *Resolving) Register(b *gs.BeanDefinition) *gs.RegisteredBean
Constants ¶
const ( RefreshDefault = RefreshState(iota) Refreshing Refreshed )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BeanGroupFunc ¶
type BeanGroupFunc func(p conf.Properties) ([]*gs.BeanDefinition, error)
BeanGroupFunc defines a function that dynamically registers beans based on configuration properties.
type CondContext ¶
type CondContext struct {
// contains filtered or unexported fields
}
CondContext provides condition evaluation context during resolution.
func (*CondContext) Find ¶
func (c *CondContext) Find(s gs.BeanSelector) ([]gs.CondBean, error)
Find returns beans matching the selector after resolving their conditions.
func (*CondContext) Has ¶
func (c *CondContext) Has(key string) bool
Has checks if a configuration property exists.
type RefreshState ¶
type RefreshState int
RefreshState represents the current state of the container.
type Resolving ¶
type Resolving struct {
// contains filtered or unexported fields
}
Resolving manages bean definitions, mocks, and dynamic bean registration functions.
func (*Resolving) Beans ¶
func (c *Resolving) Beans() []*gs_bean.BeanDefinition
Beans returns all active bean definitions, excluding deleted ones.
func (*Resolving) GroupRegister ¶
func (c *Resolving) GroupRegister(fn BeanGroupFunc)
GroupRegister adds a function to dynamically register beans.
func (*Resolving) Object ¶
func (c *Resolving) Object(i any) *gs.RegisteredBean
Object registers a pre-constructed instance as a bean.
func (*Resolving) Refresh ¶
func (c *Resolving) Refresh(p conf.Properties) error
Refresh performs the full initialization process of the container. It transitions through several phases: - Executes group functions to register additional beans. - Scans configuration beans and registers their methods as beans. - Applies mock beans to override specific targets. - Resolves all beans based on their conditions. - Validates that no duplicate beans exist.
func (*Resolving) Register ¶
func (c *Resolving) Register(b *gs.BeanDefinition) *gs.RegisteredBean
Register adds a bean definition to the container.