代码拉取完成,页面将自动刷新
package processor
import (
"gitee.com/kristas/booting-go/framework/common/util/reflectx"
"gitee.com/kristas/booting-go/framework/core/bean"
"gitee.com/kristas/booting-go/framework/core/component"
"gitee.com/kristas/booting-go/framework/core/configure"
"gitee.com/kristas/booting-go/framework/logging"
"reflect"
)
type AutoConfigureProcessor struct {
Log logging.Logger `bean:"log"`
}
func (r *AutoConfigureProcessor) Filter(bean bean.Bean) bool {
return true
}
func (r *AutoConfigureProcessor) Do(b bean.Bean) {
reflectx.WalkStructField(b, func(field reflect.StructField, value reflect.Value) {
if t, ok := field.Tag.Lookup("configure"); ok && t == "auto" {
if field.Type.Implements(reflect.TypeOf(new(component.Configuration)).Elem()) {
conf := reflect.New(field.Type.Elem())
configure.InjectConfiguration(conf.Interface().(component.Configuration))
value.Set(conf)
} else {
r.Log.Errorf("%s is not implement configuration", field.Type)
}
}
//if field.Type.Implements(reflect.TypeOf(new(announce.Configuration)).Elem()) {
// conf := reflect.New(field.Type.Elem())
// configure.InjectConfiguration(conf.Interface().(announce.Configuration))
// value.Set(conf)
//}
}, true)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。