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

关于controller方法参数设计而引申到拦截器精确定位的问题 #8

Open
ZS1994 opened this issue Feb 27, 2017 · 1 comment

Comments

@ZS1994
Copy link

ZS1994 commented Feb 27, 2017

controller的方法的参数要不要约定好(比如全部实现一个公共接口从而强制约定),如果不这样,那么在拦截器中如何精确获取访问的类以及方法呢?
我现在的思路是在拦截器的preHandle方法中将handler强转为HandlerMethod,调用getMethod方法去与目标class的getMethod对比,但是你看class的getMethod,其中参数为getMethod(name, parameterTypes),如果不对controller方法的参数进行约定,这写起来会很混乱,而且代码会写的很长(很不好看)。
所以我想问下,controller方法参数怎么设计好呢?

@ZS1994
Copy link
Author

ZS1994 commented Feb 27, 2017

项目我没有去看,我直接看你写的博客,我看到最后你写的controller那里你并没有作处理

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

1 participant