@@ -48,35 +48,38 @@ func As[T any]() reflect.Type {
4848type Arg = gs.Arg
4949
5050// TagArg returns a TagArg with the specified tag.
51+ // Used for property binding or object injection when providing constructor parameters.
5152func TagArg (tag string ) Arg {
5253 return gs_arg .Tag (tag )
5354}
5455
5556// ValueArg returns a ValueArg with the specified value.
57+ // Used to provide specific values for constructor parameters.
5658func ValueArg (v interface {}) Arg {
5759 return gs_arg .Value (v )
5860}
5961
6062// IndexArg returns an IndexArg with the specified index and argument.
63+ // When most constructor parameters can use default values, IndexArg helps reduce configuration effort.
6164func IndexArg (n int , arg Arg ) Arg {
6265 return gs_arg .Index (n , arg )
6366}
6467
65- // BindArg returns an BindArg for the specified function and arguments.
68+ // BindArg returns a BindArg for the specified function and arguments.
69+ // Used to provide argument binding for option-style constructor parameters.
6670func BindArg (fn interface {}, args ... Arg ) * gs_arg.BindArg {
6771 return gs_arg .Bind (fn , args ... )
6872}
6973
7074/************************************ cond ***********************************/
7175
7276type (
73- CondFunc = gs.CondFunc
7477 Condition = gs.Condition
7578 CondContext = gs.CondContext
7679)
7780
7881// OnFunc creates a Condition based on the provided function.
79- func OnFunc (fn CondFunc ) Condition {
82+ func OnFunc (fn func ( ctx CondContext ) ( bool , error ) ) Condition {
8083 return gs_cond .OnFunc (fn )
8184}
8285
@@ -137,6 +140,11 @@ func None(conditions ...Condition) Condition {
137140
138141/************************************ ioc ************************************/
139142
143+ type (
144+ BeanID = gs.BeanID
145+ BeanMock = gs.BeanMock
146+ )
147+
140148type (
141149 Dync [T any ] = gs_dync.Value [T ]
142150)
@@ -201,21 +209,19 @@ type AppStarter struct{}
201209
202210// Web enables or disables the built-in web server.
203211func Web (enable bool ) * AppStarter {
204- if ! enable {
205- EnableSimpleHttpServer (false )
206- }
212+ EnableSimpleHttpServer (enable )
207213 return & AppStarter {}
208214}
209215
210216// Run runs the app and waits for an interrupt signal to exit.
211217func (s * AppStarter ) Run () {
212- printBanner ()
213218 var err error
214219 defer func () {
215220 if err != nil {
216221 syslog .Errorf ("app run failed: %s" , err .Error ())
217222 }
218223 }()
224+ printBanner ()
219225 if err = B .(* gs_app.BootImpl ).Run (); err != nil {
220226 return
221227 }
@@ -274,7 +280,7 @@ func GroupRegister(fn func(p conf.Properties) ([]*BeanDefinition, error)) {
274280
275281// RefreshProperties refreshes the app configuration.
276282func RefreshProperties () error {
277- p , err := Config () .Refresh ()
283+ p , err := gs_app . GS . P .Refresh ()
278284 if err != nil {
279285 return err
280286 }
0 commit comments