JFinal+Jetty十行代码完成漂亮的RESTFul微服务框架
main函数启动
0配置文件
简洁
JFinal+Jetty 强强联合
show me the code
public static void main(String args[]){ EnumSet<DispatcherType> all = EnumSet.of(DispatcherType.ASYNC, DispatcherType.ERROR, DispatcherType.FORWARD,DispatcherType.INCLUDE, DispatcherType.REQUEST); final Server server = new Server(888); try{ WebAppContext context = new WebAppContext("/","/"); FilterHolder filter = new FilterHolder(new JFinalFilter()); filter.setInitParameter("configClass", "com.demo.common.config.DemoConfig"); context.addFilter(filter, "/*", all); server.setHandler(context); server.start(); server.join(); }catch (Exception e){ e.printStackTrace(); } }
看到main函数难道你不激动吗?那青葱岁月映入眼帘...
微服务框架用JFinal+Jetty,就这么定了。