配合 JAX-RS标准

基于Restlight Core为兼容JAX-RS注解使用习惯的扩展实现

eg.

引入依赖

<dependency>
	<groupId>io.esastack</groupId>
	<artifactId>restlight-core</artifactId>
	<version>${restlight.version}</version>
</dependency>
<dependency>
	<groupId>io.esastack</groupId>
	<artifactId>restlight-jaxrs-provider</artifactId>
	<version>${restlight.version}</version>
</dependency>

编写Controller

@Path("/hello")
public class HelloController {

    @Path("/restlight")
    @GET
    @Produces(MediaType.TEXT_PLAIN_VALUE)
    public String restlight() {
        return "Hello Restlight!";
    }
}

使用Restlight启动Server

Restlight.forServer()
        .daemon(false)
        .deployments()
        .addController(HelloController.class)
        .server()
        .start();

启动并访问: http://localhost:8080/hello 即可看到输出:

Hello Restlight!