您好,欢迎访问一九零五行业门户网

java中有哪些常见微服务框架

常见微服务框架介绍:
spring boot:这可能是最好的java微服务框架了,它适用于控制反转、面向切面编程等等。
示例代码:
import org.springframework.boot.*;import org.springframework.boot.autoconfigure.*;import org.springframework.stereotype.*;import org.springframework.web.bind.annotation.*;@restcontroller@enableautoconfigurationpublic class example { @requestmapping("/") string home() { return "hello world!"; } public static void main(string[] args) throws exception { springapplication.run(example.class, args); }}
jersey:这个开源框架支持java的jax-rs api,使用起来非常容易。
示例代码:
package org.glassfish.jersey.examples.helloworld;import javax.ws.rs.get;import javax.ws.rs.path;import javax.ws.rs.produces;@path("helloworld")public class helloworldresource { public static final string cliched_message = "hello world!"; @get @produces("text/plain") public string gethello() { return cliched_message; }}
play:框架可以让你很方便地使用scala和java来构建、创建和部署web应用程序。对于需要并行处理远程调用的restful应用程序来说,play框架是理想的选择。它是模块化的,支持异步。
示例代码:
package controllers;import play.mvc.*;public class application extends controller { public static void index() { render(); } public static void sayhello(string myname) { render(myname); }}
推荐教程:java入门教程
以上就是java中有哪些常见微服务框架的详细内容。
其它类似信息

推荐信息