resolving

package
v1.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RefreshDefault = RefreshState(iota)
	RefreshPrepare
	Refreshing
	Refreshed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConditionContext added in v1.2.3

type ConditionContext struct {
	// contains filtered or unexported fields
}

ConditionContext provides an evaluation context for conditions during bean resolution.

func (*ConditionContext) Find added in v1.2.3

Find returns all beans that match the provided selector and are successfully resolved (active).

func (*ConditionContext) Has added in v1.2.3

func (c *ConditionContext) Has(key string) bool

Has checks if a configuration property exists.

func (*ConditionContext) Prop added in v1.2.3

func (c *ConditionContext) Prop(key string, def ...string) string

Prop retrieves a configuration property by key, optionally returning a default value if the key is not found.

type Module added in v1.2.3

type Module struct {
	// contains filtered or unexported fields
}

Module represents a module that can register additional beans when certain conditions are met.

type RefreshState

type RefreshState int

RefreshState represents the current state of the container.

type Resolving

type Resolving struct {
	// contains filtered or unexported fields
}

Resolving is the core container responsible for holding bean definitions, processing modules, applying mocks, scanning configuration beans, and resolving beans against conditions.

func New

func New() *Resolving

New creates an empty Resolving instance.

func (*Resolving) AddMock

func (c *Resolving) AddMock(mock gs.BeanMock)

AddMock registers a mock bean which can override an existing bean during the refresh phase.

func (*Resolving) Beans

func (c *Resolving) Beans() []*gs_bean.BeanDefinition

Beans returns all active bean definitions, excluding deleted ones.

func (*Resolving) Module added in v1.2.3

func (c *Resolving) Module(conditions []gs_cond.ConditionOnProperty, fn func(p conf.Properties) error)

Module registers a conditional module that will be executed to add beans before the container starts refreshing.

func (*Resolving) Object

func (c *Resolving) Object(i any) *gs.RegisteredBean

Object registers a pre-constructed instance as a bean definition.

func (*Resolving) Provide

func (c *Resolving) Provide(ctor any, args ...gs.Arg) *gs.RegisteredBean

Provide registers a constructor function and optional arguments as a bean.

func (*Resolving) Refresh

func (c *Resolving) Refresh(p conf.Properties) error

Refresh performs the full lifecycle of container initialization. The phases are as follows:

  1. Apply registered modules to register additional beans.
  2. Scan configuration beans and register methods as beans.
  3. Apply mock beans to override specific target beans.
  4. Resolve conditions for all beans and mark inactive ones as deleted.
  5. Check for duplicate beans (by type and name).
  6. Validate that all root beans are resolved and ready to wire.

func (*Resolving) Register

func (c *Resolving) Register(b *gs.BeanDefinition) *gs.RegisteredBean

Register adds a bean definition to the container. It must be called before the container starts refreshing.

func (*Resolving) Root added in v1.2.5

func (c *Resolving) Root(b *gs.RegisteredBean)

Root marks a registered bean as a root bean.

func (*Resolving) Roots added in v1.2.3

func (c *Resolving) Roots() []*gs_bean.BeanDefinition

Roots returns all root beans.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL