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

[WeOpen-Star] Add simpler client annotations with @AliasFor #3805

Closed
loongs-zhang opened this issue Aug 5, 2022 · 12 comments · Fixed by #3838
Closed

[WeOpen-Star] Add simpler client annotations with @AliasFor #3805

loongs-zhang opened this issue Aug 5, 2022 · 12 comments · Fixed by #3838

Comments

@loongs-zhang
Copy link
Member

loongs-zhang commented Aug 5, 2022

How to Participation

  1. reply: [WeOpen Star]I would like to help
  2. add this wechat. note : 摘星

image

Description

As a downstream of #3485, this task needs you to add(do not delete any existing annotations) more simpler client annotations.

For example, below is how we use client annotation now:

@RestController
@RequestMapping("/order")
@ShenyuSpringCloudClient("/order")
public class OrderController {
    
    @PostMapping("/save")
    @ShenyuSpringCloudClient("/save")
    public OrderDTO save(@RequestBody final OrderDTO orderDTO) {
        orderDTO.setName("hello world spring cloud save order");
        return orderDTO;
    }
}

Does it seem a little repetitive? We can realize combined annotation through @AliasFor and org.springframework.core.annotation.AnnotatedElementUtils#findMergedAnnotation.

Notice: the newly added annotation needs to be compatible with all functions of other frameworks !

Use simplified annotations like below:

@RestController
@ShenyuRequestMapping("/order")
public class OrderController {
    
    @ShenyuPostMapping("/save")
    public OrderDTO save(@RequestBody final OrderDTO orderDTO) {
        orderDTO.setName("hello world spring cloud save order");
        return orderDTO;
    }
}

You are welcome to make suggestions !

Task List

    • add @ShenyuRequestMapping, @ShenyuGetMapping, @ShenyuPostMapping, @ShenyuPutMapping, @ShenyuDeleteMapping, @ShenyuPatchMapping for shenyu-client-springmvc; @ShawnJim
    • add @ShenyuRequestMapping, @ShenyuGetMapping, @ShenyuPostMapping, @ShenyuPutMapping, @ShenyuDeleteMapping, @ShenyuPatchMapping for shenyu-client-springcloud; @ShawnJim
    • add @ShenyuService, @ShenyuDubboService for shenyu-client-apache-dubbo; @mangoGoForward
    • add @ShenyuMotanService for shenyu-client-motan; @runqi-zhao
    • add @ShenyuTarsServant for shenyu-client-tars; @hezean
    • add @ShenyuServerEndpoint for shenyu-client-websocket; @lahmXu

How to contributor

You can see this : Contributor Guide

  1. I suggest you subscribe to shenyu dev mailing list, and when you encounter any problems, or when you finish,
    you can send an email to dev@shenyu.apache.org

  2. I suggest you git clone the source code and finish the changes. like this :

fork this to you repository : https://github.com/apache/shenyu.git

git clone git@github.com:${YOUR_USERNAME}/${TARGET_REPO}.git

git checkout -b a-dev-branch

git push origin a-dev-branch

Verification

After you modify file in verify local and you can see this : How to build shenyu .

After you pull request merged. You can verify to this : en-doc , zh-doc

@loongs-zhang loongs-zhang changed the title [Task] Add simpler client annotations with @AliasFor [WeOpen-Star] [Task] Add simpler client annotations with @AliasFor Aug 5, 2022
@ShawnJim
Copy link
Contributor

ShawnJim commented Aug 5, 2022

[WeOpen Star] I would like to help. pls assign task [1,2] to me . thanks.

@yu199195 yu199195 changed the title [WeOpen-Star] [Task] Add simpler client annotations with @AliasFor [WeOpen-Star] Add simpler client annotations with @AliasFor Aug 5, 2022
@lahmXu
Copy link
Member

lahmXu commented Aug 5, 2022

[WeOpen Star]I would like to help, Please assign task 7 to me, thanks!

@hezean
Copy link

hezean commented Aug 5, 2022

[WeOpen Star] I would like to help with task 6. Can you assign me? Many thanks.

@mangoGoForward
Copy link
Contributor

Hi, I'd like to work on task 3. [WeOpen Star]

@loongs-zhang
Copy link
Member Author

hi, @dragon-zhang ,i can do task [1,2] . can you assign it to me? thx

Please reply [WeOpen Star]I would like to help and task number to get the task.

@loongs-zhang
Copy link
Member Author

Hi, I'd like to work on task 6. Can you assign me? Many thanks.

Please reply [WeOpen Star]I would like to help and task number to get the task.

@mangoGoForward
Copy link
Contributor

[WeOpen Star]I would like to help, task 4.
task 4 is similar with task 3

@loongs-zhang
Copy link
Member Author

[WeOpen Star]I would like to help, task 4. task 4 is similar with task 3

Yes, but due to different versions, different annotations need to be supported.

@runqi-zhao
Copy link
Contributor

[WeOpen Star]I would like to help, please assign task 5 to me, thanks!

ShawnJim added a commit to ShawnJim/shenyu that referenced this issue Aug 10, 2022
ShawnJim added a commit to ShawnJim/shenyu that referenced this issue Aug 10, 2022
ShawnJim added a commit to ShawnJim/shenyu that referenced this issue Aug 10, 2022
ShawnJim added a commit to ShawnJim/shenyu that referenced this issue Aug 11, 2022
ShawnJim added a commit to ShawnJim/shenyu that referenced this issue Aug 11, 2022
ShawnJim added a commit to ShawnJim/shenyu that referenced this issue Aug 11, 2022
@loongs-zhang loongs-zhang reopened this Aug 12, 2022
ShawnJim added a commit to ShawnJim/shenyu that referenced this issue Aug 14, 2022
# Conflicts:
#	shenyu-examples/shenyu-examples-springmvc/src/main/java/org/apache/shenyu/examples/springmvc/controller/OrderController.java
ShawnJim added a commit to ShawnJim/shenyu that referenced this issue Aug 14, 2022
lahmXu added a commit to lahmXu/shenyu that referenced this issue Aug 15, 2022
lahmXu added a commit to lahmXu/shenyu that referenced this issue Aug 15, 2022
lahmXu added a commit to lahmXu/shenyu that referenced this issue Aug 16, 2022
loongs-zhang pushed a commit that referenced this issue Aug 24, 2022
* [task: websocket plugin #3805] Add simpler client annotations

* [task: websocket plugin #3805] remove empty lines

* [task: websocket plugin #3805] use AnnotatedElementUtils#findMergedAnnotation instead.
ShawnJim added a commit to ShawnJim/shenyu that referenced this issue Aug 24, 2022
ShawnJim added a commit to ShawnJim/shenyu that referenced this issue Aug 24, 2022
loongs-zhang pushed a commit that referenced this issue Aug 24, 2022
…ingcloud` and `shenyu-client-springmvc`. (#3819)

* [ISSUE #3805] Add convenience annotation like `Shenyu**Mapping` for shenyu-client-springcloud.

* [ISSUE #3805] Add convenience annotation like `Shenyu**Mapping` for shenyu-client-springmvc.

* [ISSUE #3805] fix check style.

* [ISSUE #3805] Add methods of @RequestMapping to simpler annotations for spring-client-springcloud.

* [ISSUE #3805] Add Unit Test for simpler annotations for spring-client-springcloud.

* [ISSUE #3805] Add methods of @RequestMapping to simpler annotations for spring-client-springmvc.

* [ISSUE #3805] Add Unit Test for simpler annotations for spring-client-springmvc.

* [ISSUE #3805] Use simpler annotations for shenyu-example-springcloud.

* [ISSUE #3805] Add simpler annotation for shenyu-client-springcloud and shenyu-client-springmvc.

* [ISSUE #3805] Add path replace logic in AbstractShenyuClientRegisterServiceImpl::buildRuleDTO.

* [ISSUE #3085] fix check style.

* [ISSUE #3085] Change @AliasFor#attribute to @AliasFor#annotation.

* [ISSUE #3805] Add `@AliasFor(annotation = RequestMapping.class)` in @RequestMapping#method.
@loongs-zhang
Copy link
Member Author

@runqi-zhao @hezean How is the progress now?

@hezean
Copy link

hezean commented Aug 29, 2022

Sorry for the delay, I'll submit a PR today

@runqi-zhao
Copy link
Contributor

@runqi-zhao @hezean How is the progress now?

Sorry for the delay, I'll submit a PR today

loongs-zhang added a commit that referenced this issue Oct 20, 2022
* Add simpler client annotations for motan

* fix ci

* fix ci

* Add simpler client annotations for motan

* Add simpler client annotations for motan

* Add simpler client annotations for motan

* fix ci

* fix ci

* update motan version

* update motan version

Co-authored-by: dragon-zhang <hailang@webuy.ai>
@yu199195 yu199195 closed this as completed May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment