Documentation
¶
Index ¶
- type App
- type Boot
- type BootImpl
- func (b *BootImpl) Config() *gs_conf.BootConfig
- func (b *BootImpl) Object(i any) *gs.RegisteredBean
- func (b *BootImpl) Provide(ctor any, args ...gs.Arg) *gs.RegisteredBean
- func (b *BootImpl) Root(x *gs.RegisteredBean)
- func (b *BootImpl) Run() error
- func (b *BootImpl) Runner(fn func() error) *gs.RegisteredBean
- type ReadySignal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { C *gs_core.Container // IoC container P *gs_conf.AppConfig // Application configuration Runners []gs.Runner `autowire:"${spring.app.runners:=?}"` Jobs []gs.Job `autowire:"${spring.app.jobs:=?}"` Servers []gs.Server `autowire:"${spring.app.servers:=?}"` EnableJobs bool `value:"${spring.app.enable-jobs:=true}"` EnableServers bool `value:"${spring.app.enable-servers:=true}"` // contains filtered or unexported fields }
App represents the core application, managing its lifecycle, configuration, and dependency injection.
func (*App) Exiting ¶
Exiting returns whether the application is currently in the process of shutting down.
func (*App) ShutDown ¶
func (app *App) ShutDown()
ShutDown initiates a graceful shutdown of the application by setting the exiting flag and cancelling the root context.
func (*App) Start ¶
Start initializes and launches the application. It performs the following steps: 1. Registers the App itself as a root bean. 2. Loads application configuration. 3. Refreshes the IoC container to initialize and wire beans. 4. Runs all registered Runners. 5. Launches Jobs (if enabled) as background goroutines. 6. Starts all Servers (if enabled) and waits for readiness.
func (*App) WaitForShutdown ¶ added in v1.2.5
func (app *App) WaitForShutdown()
WaitForShutdown waits for the application to be signaled to shut down and then gracefully stops all servers and jobs.
type Boot ¶
type Boot interface { // Config returns the boot configuration. Config() *gs_conf.BootConfig // Object registers an existing object as a bean in the container. Object(i any) *gs.RegisteredBean // Provide registers a bean using a constructor function and optional arguments. Provide(ctor any, args ...gs.Arg) *gs.RegisteredBean // Runner creates and registers a Runner from a given function. Runner(fn func() error) *gs.RegisteredBean }
Boot defines the interface for application bootstrapping.
type BootImpl ¶
type BootImpl struct { Runners []gs.Runner `autowire:"${spring.boot.runners:=?}"` // contains filtered or unexported fields }
BootImpl is the concrete implementation of the Boot interface. It manages the application's bootstrapping process.
func (*BootImpl) Config ¶
func (b *BootImpl) Config() *gs_conf.BootConfig
Config returns the boot configuration.
func (*BootImpl) Object ¶
func (b *BootImpl) Object(i any) *gs.RegisteredBean
Object registers an existing object as a bean in the container.
func (*BootImpl) Provide ¶
Provide registers a bean using a constructor function and optional arguments.
func (*BootImpl) Root ¶ added in v1.2.5
func (b *BootImpl) Root(x *gs.RegisteredBean)
Root registers a root bean definition in the container.
type ReadySignal ¶
type ReadySignal struct {
// contains filtered or unexported fields
}
ReadySignal is a synchronization helper used to indicate when an application is ready to serve requests.
func NewReadySignal ¶
func NewReadySignal() *ReadySignal
NewReadySignal creates and returns a new ReadySignal instance.
func (*ReadySignal) Close ¶
func (s *ReadySignal) Close()
Close closes the signal channel, notifying all goroutines waiting on it.
func (*ReadySignal) Intercept ¶
func (s *ReadySignal) Intercept()
Intercept marks the signal as intercepted.
func (*ReadySignal) Intercepted ¶
func (s *ReadySignal) Intercepted() bool
Intercepted returns true if the signal has been intercepted.
func (*ReadySignal) TriggerAndWait ¶
func (s *ReadySignal) TriggerAndWait() <-chan struct{}
TriggerAndWait marks an operation as done by decrementing the WaitGroup counter, and then returns the readiness signal channel for waiting.
func (*ReadySignal) Wait ¶
func (s *ReadySignal) Wait()
Wait blocks until all WaitGroup counters reach zero.