ext

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package ext provides optional, opt-in extensions for the ioc container that are not part of the default startup behavior.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSkipInitializationPostProcessor

func NewSkipInitializationPostProcessor() container.ComponentPostProcessor

NewSkipInitializationPostProcessor builds a SkipInitializationPostProcessor.

func SkipComponentInitialization

func SkipComponentInitialization() app.SettingOption

SkipComponentInitialization returns a SettingOption that performs dependency injection only: every component's Init()/AfterPropertiesSet() is skipped and all ApplicationRunner.Run() invocations are skipped as well.

It is intended for local development when real dependencies (databases, cluster services, etc.) are unreachable but the wiring/injection capability is still needed. Note that since initialization is short-circuited, the after-initialization processor chain (e.g. AOP proxying done in PostProcessAfterInitialization) is also skipped for every component.

Usage:

ioc.Run(ext.SkipComponentInitialization(), app.SetComponents(...))

Types

type SkipInitializationPostProcessor

type SkipInitializationPostProcessor struct {
	processors.DefaultComponentPostProcessor
}

SkipInitializationPostProcessor skips the initialization phase of every component. By returning nil from PostProcessBeforeInitialization it short-circuits Factory's InitializeComponentWithContext before invokeInitMethods runs, so neither Init()/Init(ctx) nor AfterPropertiesSet() is called.

Dependency injection (wire/value/prop/prefix/func) is unaffected: it completes during the populate phase, which happens before initialization.

func (*SkipInitializationPostProcessor) Order

Order places this processor at the end of the ordered ComponentPostProcessor chain.

func (*SkipInitializationPostProcessor) PostProcessBeforeInitialization

func (p *SkipInitializationPostProcessor) PostProcessBeforeInitialization(component any, componentName string) (any, error)

PostProcessBeforeInitialization returns nil to skip the component's initialization methods. The factory keeps and exposes the already-populated instance unchanged.

Jump to

Keyboard shortcuts

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