Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请不要重复造轮子,删除这个无用操作 #9

Closed
Lyn4ever29 opened this issue Jul 9, 2021 · 4 comments
Closed

请不要重复造轮子,删除这个无用操作 #9

Lyn4ever29 opened this issue Jul 9, 2021 · 4 comments

Comments

@Lyn4ever29
Copy link

你用自己的注解把@EnableFeignClients包装一下就可以自己用了吗?你这操作是真的醉了 ,请问这样的意义何在。

Rjt6u6.png

在你们自己的文档中还有这样一句话,你不让别人做,自己又这么做了,对新手一点儿也不友好。
RjNA54.png

@lltx
Copy link
Collaborator

lltx commented Jul 9, 2021

    1. 本人有代码洁癖

请注意代码的 https://github.com/pig-mesh/pig/blob/master/pig-common/pig-common-feign/src/main/java/com/pig4cloud/pig/common/feign/annotation/EnablePigFeignClients.java#L54

这里指定了整个框架的 扫描范围, 不需要 每个 Main 上边都是这种 @@EnableFeignClients("com.pig4cloug.xx.xxx")

你不觉着代码很丑?

    1. common-feign 模块同样支持 spi 的注入, 通过我们文档提供的 pig-gen 的archetype 你就完全不需要去考虑什么扫描范围
      约定大于配置
    1. 通过上述两种形式,可以避免同包、不同包的扫描问题和排错问题

@ChunMengLu
Copy link
Contributor

这种方式统一了框架的规范和行为,避免不同开发同学照成不同配置,减少团队协作的成本,提高代码质量。

对于新手有疑问很好,可以交流,很多事情都有不同的考虑角度。

@lltx
Copy link
Collaborator

lltx commented Jul 9, 2021

这是一个开源项目,我们非常欢迎您的贡献和加入,无论是微不足道的清理或大的新功能。

https://www.yuque.com/pig4cloud/pig/lceu0v

@Second-dimension
Copy link
Contributor

Second-dimension commented Jul 9, 2021

我觉得这就是一个很简单的封装思想,定义了注册feign客户端扫包的包名,让整个框架保持统一风格,并且pig还提供生成脚手架的archetype,避免了不必要的麻烦。

一处定义跟处处定义哪个比较好

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants