[关闭]
@liuhui0803 2016-07-23T02:40:36.000000Z 字数 1184 阅读 2159

WSO2 MSF4J增添对Spring和Swagger的支持

体系结构和设计 开发 Swagger SOA Spring


摘要:

WSO2 MSF4J 2.0增添了对Spring、Swagger定义生成、ExceptionMapper以及StreamingOutput的支持。

正文:

WSO2 MSF4J 2.0已增添了对Spring、Swagger定义生成、ExceptionMapper以及StreamingOutput的支持。

WSO2 MSF4J是一种通过Java构建微服务的开源框架。根据WSO2的介绍,该框架的内存痕迹可低至25MB,启动时间不超过400ms。该框架最近发布的2.0版包含诸多改进,例如:

WSO2 MSF4J的一些主要功能包括:

若要使用MSF4J创建微服务,开发者需要通过注解Java类以定义API端点,并使用Runner进行部署。最基本的HelloWorld示例是这样的:

  1. @Path("/hello")
  2. public class HelloService {
  3. @GET
  4. @Path("/{name}")
  5. public String hello(@PathParam("name") String name) {
  6. return "Hello " + name;
  7. }
  8. }

可这样部署:

  1. public class Application {
  2. public static void main(String[] args) {
  3. new MicroservicesRunner()
  4. .deploy(new HelloService())
  5. .start();
  6. }
  7. }

通过上述操作,下列URL

  1. curl http://localhost:8080/hello/world

就可以生成“Hello World”的响应。

使用WSO2 MSF4J创建的微服务可使用Maven构建并部署到Docker容器中。

作者Abel Avram阅读英文原文WSO2 MSF4J Adds Support for Spring and Swagger

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注