Java微服务框架Microserver

Microserver 是一个零配置、基于标准的身经百战的库,用来运行 Java REST 微服务,通过 Java 标准 main 类执行。从 2014 年开始就一直在 AOL 生产环境中使用。

框架结构:

high level architecture

main 类:

1
2
3
4
5
public class AppRunnerTest {
    public static void main(String[] args) throws InterruptedException {
        new MicroserverApp(() -> "test-app").run();
    }
}

服务类:

1
2
3
4
5
6
7
8
9
10
@Rest
@Path("/status")
public class StatusResource {
  @GET
  @Produces("text/plain")
  @Path("/ping")
  public String ping() {
     return "ok";
  }
}

aol / micro-server

  1. da shang
    donate-alipay
               donate-weixin weixinpay

发表评论↓↓