Bootor组件概述
本文档在于指导如何快速启动一个最简单的微服务
项目引入
将cloudx项目引入到eclipse或者idea
新建DemoAppliction类
package cloud.apposs.bootor;
public class DemoApplication {
public static void main(String[] args) throws Exception {
HttpApplication.run(DemoApplication.class, args);
}
}
新建UserAction类
package cloud.apposs.bootor;
// 添加此注解是为了让框架能够扫描到此Action进行MVC开发
@RestAction
public class UserAction {
// 匹配HTTP根路径请求
@Request("/")
public RxIo<String> root() {
return RxIo.just("Hello Index Html");
}
}
运行DemoApplication
输出如下
_ _ __ __
___ | | ___ _ _ __| |_ __\ \\ \
/ __ | |/ _ \| | | |/ _` \ \/ / \ \\ \
| (__ | | (_) | |_| | (_| |> < / // /
\___ |_|\___/ \__,_|\__,_/_/\_\/_//_/
:: CloudX Boot :: v1.1.0.RELEASE
20xx-xx-30 00:00:xx INFO: OS Name: Windows 7
20xx-xx-30 00:00:xx INFO: OS Arch: amd64
20xx-xx-30 00:00:xx INFO: Java Home: E:\Setup\Jdk8\jre
20xx-xx-30 00:00:xx INFO: Java Version: 1.8
20xx-xx-30 00:00:xx INFO: Java Vendor: Oracle Corporation
20xx-xx-30 00:00:xx INFO: Jvm Argument: [-javaagent:E:\Setup\Idea2018\lib\idea_rt.jar=64700:E:\Setup\Idea2018\bin]
20xx-xx-30 00:00:xx INFO: Jvm Argument: [-Dfile.encoding=UTF-8]
20xx-xx-30 00:00:xx INFO: Mapped {Bean: UserAction, Method: [*], Path: /} on public RxIo root()
20xx-xx-30 00:00:xx INFO: Server Start Listening On 0.0.0.0:8880
20xx-xx-30 00:00:xx INFO: DemoApplication Bootor Server Start Success In 1251 MilliSeconds
测试
浏览器访问http://localhost:8880,输出如下
Hello Index Html
一个最简单的异步微服务便已经起来了