startup

command
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

README

Startup

中文

This project, though small in size, showcases the essential capabilities of Go-Spring.

Features

1. Layered Configuration

Configurations can be loaded from various sources including:

  • sysconf
  • Local files
  • Remote files
  • Environment variables
  • Command-line arguments
2. Property Binding

Configurations from files, command-line arguments, or environment variables can be bound directly to struct fields.

type Service struct {
    StartTime time.Time `value:"${start-time}"`
}
3. Dependency Injection

Go-Spring automatically organizes dependencies between beans and injects them at runtime.

gs.Provide(func (s *Service) *http.ServeMux {
    http.HandleFunc("/echo", s.Echo)
    http.HandleFunc("/refresh", s.Refresh)
    return http.DefaultServeMux
})
4. Dynamic Configuration Refresh

Configurations can be refreshed at runtime without restarting the application, enabling real-time updates.

type Service struct {
    RefreshTime gs.Dync[time.Time] `value:"${refresh-time}"`
}
5. Route Registration

Supports HTTP server setup with customizable routing.

gs.Provide(func (s *Service) *http.ServeMux {
    http.HandleFunc("/echo", s.Echo)
    http.HandleFunc("/refresh", s.Refresh)
    return http.DefaultServeMux
})

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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