-
Notifications
You must be signed in to change notification settings - Fork 214
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
一个Action类只能实现一个路由? #12
Comments
哈哈 是的。
在上篇文章中有写到后续会有这个更新。 |
@crossoverJie |
现在已经有一个大概的思路。其中的参数传递可以是自定义的 @CicadaExcute("get")
public void get(CicadaContext context,User user){
context.json(user);
} 甚至 同时也可以在参数中使用 只需要在路由过程中将数据反射写入具体的参数即可。 |
谢谢你的解答,期待其实现 |
@crossoverJie |
嗯,实现都是一样的。只是注解可读性更强。 |
Is your feature request related to a problem? Please describe.
Action
类是通过实现WorkAction
接口的execute()
方法来实现路由的,这样一个类只能实现一个路由,实际使用起来未必会有点麻烦吧Describe the solution you'd like
如果能够像spring mvc那样一个controller下可以有多个RequestMapping就比较好吧。
Describe alternatives you've considered
Action
类不用实现WorkAction
接口,直接扫描所有被@CicadaAction
注解的类,然后再反射获取这个类中被@CicadaExcute
注解的方法(我看到有@CicadaExcute
这个注解,但没有被使用,是否是准备用于这方面的?),再反射调用这个方法。不过这样的话就是比较难约束用户对于被
@CicadaExcute
注解的方法传入的参数,我想到有两种方式约束:CicadaContext
和Param
,否则就抛出异常CicadaContext
或Param
就在invoke的时候传进去,如果没有就不传,如果有其他参数就传null值。The text was updated successfully, but these errors were encountered: