thrift注意点

36 篇文章 0 订阅

一些知识点参考于:https://blog.csdn.net/u010900754/article/details/80172671

1、thrift服务不支持重载(因为thrift支持多语言,有的语言是不支持重载的)。

2、thrift文件名要小写(xxx.thrift)。

3、可以include其他jar包中的thrift文件(include "user_rights_resp.thrift")

4、maven中插件

  1. <build>
  2. <plugins>
  3. <plugin>
  4. <groupId>org.apache.thrift.tools </groupId>
  5. <artifactId>maven-thrift-plugin </artifactId>
  6. <version>0.1.11 </version>
  7. <configuration>
  8. <!--<thriftExecutable>/usr/local/bin/thrift</thriftExecutable>-->
  9. <!--<thriftSourceRoot>src/main/thrift</thriftSourceRoot>-->
  10. <!--<outputDirectory>src/main/java</outputDirectory>-->
  11. </configuration>
  12. <executions>
  13. <execution>
  14. <id>thrift-sources </id>
  15. <phase>generate-sources </phase>
  16. <goals>
  17. <goal>compile </goal>
  18. </goals>
  19. </execution>
  20. <!--<execution>-->
  21. <!--<id>thrift-test-sources</id>-->
  22. <!--<phase>generate-test-sources</phase>-->
  23. <!--<goals>-->
  24. <!--<goal>testCompile</goal>-->
  25. <!--</goals>-->
  26. <!--</execution>-->
  27. </executions>
  28. </plugin>
  29. </plugins>
  30. </build>

thriftExecutable,指的是thrift编译器的位置,如果我们配置了环境变量(推荐),可以不指定。验证环境变量可以使用thrift --version命令。

thriftSourceRoot,thrift源文件(xxxx.thrift文件)的目录,默认会从src/main/thrift下读取

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值