想用dubbo,但是又不想引入spring。自己搬了一下砖,用api写了一个简单的dubbo插件。
项目地址:https://gitee.com/YouYiGeXinShou/jfinal-dubbo-plugin.git
用法:
创建配置文件jfinal.properties:
//在需要暴露的服务上面使用@RpcService注解 @RpcService(group="simple", version="1.0", stub="true", mock="true") public class MyServiceImpl implements MyService{ //TODO } //引用服务 MyService myService=DubboRpc.receiveService(MyService.class); //controller引用,需要配置new ReferenceServiceAutowiredControllerFactory() public class MyController extends Controller{ @ReferenceService(group="simple", version="1.0") private MyService myService; //TODO } //使用dubbo container 启动,需要在jfinal.properties里加入configClass=YourJfinalConfigClass java com.alibaba.dubbo.container.Main jfinalContainer