- <mvc:annotation-driven ignoreDefaultModelOnRedirect="true" conversion-service="" validator="" message-codes-resolver="">
- <mvc:argument-resolvers>
- <bean class="com.lay.user.util.CustomerArgumentResolver"/>
- </mvc:argument-resolvers>
- <mvc:message-converters>
- <bean class=""/>
- </mvc:message-converters>
- <mvc:return-value-handlers>
- <bean class=""/>
- </mvc:return-value-handlers>
- </mvc:annotation-driven>
- <mvc:argument-resolvers>:参数解析器,可通过实现HandlerMethodArgumentResolver接口实现,该实现不会覆盖原有spring mvc内置解析对参数的解析,要自定义的内置支持参数解析可以考虑注册RequestMappingHandlerAdapter,以下为参考:
- @Component
- public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver {
- @Autowired
- private UserService userService;
- @Override
- public boolean supportsParameter(MethodParameter parameter) {
- return parameter.getParameterType().isAssignableFrom(UserEntity.class) && parameter.hasParameterAnnotation(LoginUser.class);
- }
- @Override
- public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer container,
- NativeWebRequest request, WebDataBinderFactory factory) throws Exception {
- //获取用户ID
- Object object = request.getAttribute(AuthorizationInterceptor.LOGIN_USER_KEY, RequestAttributes.SCOPE_REQUEST);
- if (object == null) {
- return null;
- }
- //获取用户信息
- return userService.queryObject((Long) object);
- }
- }
代码说明: supportsParameter方法主要判别参数是否为该解析器所支持的,支持:true ,不支持:false
如果返回true的话则调用resolveArgument方法。
相关推荐
<br>Published by Prentice-Hall in 1988 <br><br>ISBN 0-13-110362-8 (paperback)<br>ISBN 0-13-110370-9 <br><br>Contents<br>Preface <br>Preface to the first edition <br>Introduction <br>Chapter 1: A ...
dubbo.xsd 复制代码 <dubbo:service/> 服务配置,用于暴露一个服务,定义服务的元信息,一个服务可以用多个协议暴露,一个服务也可以注册到多个注册中心。...<dubbo:argument/> 用于指定方法参数配置。
It is handled by Jad rather than the command shell, so on<br>UNIX the last argument should be single-quoted:<br><br> jad -o -r -sjava -dsrc 'tree/**/*.class'<br><br><br>In a case you want to check ...
<dubbo:argument/> <dubbo:parameter/> 协议参考手册 dubbo:// rmi:// hessian:// http:// webservice:// thrift:// memcached:// redis:// 注册中心参考手册 Multicast注册中心 Zookeeper注册中心 Redis注册中心 ...
* <stdarg.h> : Variable Argument Lists * <stddef.h> : Definitions of General Use * <stdio.h> : Input and Output * <stdlib.h> : Utility functions * <string.h> : String functions * <time.h> : Time...
• <stdarg.h> : Variable Argument Lists • <stddef.h> : Definitions of General Use • <stdio.h> : Input and Output • <stdlib.h> : Utility functions • <string.h> : String functions • <time.h> : Time...
First we have to make sure that we have one and only one instance of Script Manager object on your page:<br><body><br><form id="form1" runat="server"><br><asp:ScriptManager ID="ScriptManager1" runat=...
project->settings->C/C++->preprocessor->additional include directory-> C:\temp\systemc-2.0.1\src Add Systemc.lib: project->add to project->files-> C:\temp\systemc-2.0.1\msvc60\systemc\debug\systemc....
If the <directory> argument is not present, report the current directory. If the directory does not exist an appropriate error should be reported. This command should also change the PWD environment ...
GPU显卡的Compute Capability需>=5.3,否则会提示error: (-217:Gpu API call) invalid device function in function 'make_policy' 编译本接口所用的工具及环境: Cmake-3.17.5 VS2019 opencv-4.2.0 opencv-contrib...
blog风格单元和分类的 META KEY, DESCRIPTION 生成问题:<br>把当前页面所有文章的META KEY, DESCRIPTION都累加起来,造成长度过长、关键词重复和描述难阅读等缺陷<br><br><br><br>二、增强功能<br><br>1....
如下所示:每个函数都有功能、用法和实例,不错的工具 <br><br>函数名: scanf <br>功 能: 执行格式化输入 <br>用 法: int scanf(char *format[,argument,...]); <br>程序例: <br><br>#include <stdio.h> <br>#...
基于extjs的.NET3.5控件Coolite 1.0.0.34580 (Preview预览版), *************************************************** * Version 1.0.0 升级日志 *... configured in the <Items> property of <ext:CompositeField>.
BASE" argument, Tomcat will<br>calculate all relative references for files in the following directories based<br>on the value of $CATALINA_BASE instead of $CATALINA_HOME:<br><br>* conf - Server ...
The following status codes may be returned after processing an IMS call<br>...<br>function argument is not coded correctly <br>AF <br>size of variable length record is invalid for GSAM get access <br>...
环境:Linux-CentOS8,Python3.6 如果你遇到python-devel无法安装的问题,发现如下错误: ...No match for argument: python-devel Error: Unable to find a match: python-devel 解决方案之一是: yum ins
<p>one</p> <div><p>two</p></div> <p>three</p> jQuery 代码: $("div > p"); 结果: [ <p>two</p> ] -------------------------------------------------------------------------------- 在文档的第一个表单...
python库。 资源全名:polidoro-py-argument-2.1.0.tar.gz
进程执行Maven插件 使用Maven改进端到端集成测试。 使用Process Executor插件,您可以按顺序在集成测试前阶段启动多个流程,然后... <argument>java</argument> <argument>-jar</argument> <argument>drop-wizard-ap