question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

How to Participation

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

Description

As a downstream of https://github.com/apache/shenyu/issues/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

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
runqi-zhaocommented, Aug 29, 2022

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

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

1reaction
hezeancommented, Aug 29, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

AliasFor Annotation in Spring - Baeldung
Learn about the @AliasFor annotation in the Spring Framework. ... Finally, to see how explicit aliases behave, let's add a simple test:
Read more >
AliasFor (Spring Framework 6.0.2 API)
@AliasFor is an annotation that is used to declare aliases for annotation attributes. Usage Scenarios. Explicit aliases within an annotation: within a ...
Read more >
Default annotation value not propagated with @AliasFor #5036
This annotation is supposed to add automatically @Client and @CircuitBreaker annotations to some interface, with some default configuration.
Read more >
Can I subclass annotations with @AliasFor? - Stack Overflow
I have some annotation which I want to change: add or change default values. Annotation cannot be subclassed, but there is an annotation...
Read more >
Spring Framework AliasFor Annotation Dilema With Solutions
With this article, we'll look at some examples of Spring Framework AliasFor annotation dilema With Solutions problems in programming.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found