dragon-zhang opened a new issue, #3485:
URL: https://github.com/apache/incubator-shenyu/issues/3485
### Description
For example, below is how we use `@ShenyuXXXXClient`:
```java
@RestController
@RequestMapping("/order")
@ShenyuSpringCloudClient(path = "/order")
public class OrderController {
/**
* Save order dto.
*
* @param orderDTO the order dto
* @return the order dto
*/
@PostMapping("/save")
@ShenyuSpringCloudClient(path = "/save")
public OrderDTO save(@RequestBody final OrderDTO orderDTO) {
orderDTO.setName("hello world spring cloud save order");
return orderDTO;
}
}
```
After use `@AliasFor` with `@ShenyuSpringCloudClient` like below:
```java
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
public @interface ShenyuSpringCloudClient {
/**
* Path string.
*
* @return the string
*/
@AliasFor(attribute = "path")
String value() default "";
/**
* Path string.
*
* @return the string
*/
@AliasFor(attribute = "value")
String path() default "";
/**
* Rule name string.
*
* @return the string
*/
String ruleName() default "";
/**
* Desc string.
*
* @return String string
*/
String desc() default "";
/**
* Enabled boolean.
*
* @return the boolean
*/
boolean enabled() default true;
}
```
We can simplify client annotation usage to:
```java
@RestController
@RequestMapping("/order")
@ShenyuSpringCloudClient("/order")
public class OrderController {
/**
* Save order dto.
*
* @param orderDTO the order dto
* @return the order dto
*/
@PostMapping("/save")
@ShenyuSpringCloudClient("/save")
public OrderDTO save(@RequestBody final OrderDTO orderDTO) {
orderDTO.setName("hello world spring cloud save order");
return orderDTO;
}
}
```
If you have some great ideas, please leave a message below, let's discuss it.
### Task List
1. - [ ] simplify @ShenyuDubboClient in `alibaba dubbo`;
2. - [ ] simplify @ShenyuDubboClient in `apache dubbo`;
3. - [ ] simplify @ShenyuGrpcClient;
4. - [ ] simplify @ShenyuSpringMvcClient;
5. - [ ] simplify @ShenyuMotanClient;
6. - [ ] simplify @ShenyuSofaClient;
7. - [ ] simplify @ShenyuTarsClient;
8. - [ ] simplify @ShenyuSpringWebSocketClient;
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]