go-spring 入门指南 介绍
Go-Spring 是模仿 Java Spring 全家桶实现的一套 GoLang 应用程序框架。 Go-Spring 的目标是让 GoLang
程序员也能用上如 Java Spring 那般威力强大的编程框架。
特性:
入门指南
Go-Spring 当前使用 Go1.12 进行开发,使用 Go Modules 进行依赖管理。
package main import ( _ "github.com/go-spring/go-spring-boot-starter/starter-gin" _ "github.com/go-spring/go-spring-boot-starter/starter-web" "github.com/go-spring/go-spring-web/spring-web" "github.com/go-spring/go-spring/spring-boot" "github.com/go-spring/go-spring/spring-core" "net/http" ) func init() { SpringBoot.RegisterModule(func(ctx Springcore.SpringContext) { ctx.RegisterBean(new(Controller)) }) } type Controller struct{} func (c *Controller) InitWebBean(wc SpringWeb.WebContainer) { wc.GET("/", c.Home) } func (c *Controller) Home(ctx SpringWeb.WebContext) { ctx.String(http.StatusOK, "OK!") } func main() { SpringBoot.RunApplication("config/") }
更多示例请见文档。
go-spring 入门指南 官网
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。