what is a resolver
resolver [rɪ'zɒlvə] 解析器
ViewResolver
The ViewResolver provides a mapping between view names and actual views.
Map<java.lang.String, org.springframework.web.servlet.View> map = null;
{view names : actual views}
举例1:
在 Controller 中 某个方法 return "s1"
经过 处理
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
之后
DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name 's1'; URL [/WEB-INF/jsp/s1.jsp]] in DispatcherServlet with name 'dispatcher'
举例2:
PathMatchingResourcePatternResolver.class
如下
<context:component-scan base-package="cn.zno.s1" />
通过 patternResolver 处理之后
2016-10-04 10:29:17 DEBUG PathMatchingResourcePatternResolver:317 - Resolved classpath location [cn/zno/s1/] to resources [URL [file:/D:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/zmvc/WEB-INF/classes/cn/zno/s1/]]
2016-10-04 10:29:17 DEBUG PathMatchingResourcePatternResolver:711 - Looking for matching resources in directory tree [D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\zmvc\WEB-INF\classes\cn\zno\s1]
2016-10-04 10:29:17 DEBUG PathMatchingResourcePatternResolver:773 - Searching directory [D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\zmvc\WEB-INF\classes\cn\zno\s1] for files matching pattern [D:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/zmvc/WEB-INF/classes/cn/zno/s1/**/*.class]
2016-10-04 10:29:17 DEBUG PathMatchingResourcePatternResolver:483 - Resolved location pattern [classpath*:cn/zno/s1/**/*.class] to resources [file [D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\zmvc\WEB-INF\classes\cn\zno\s1\Test.class]]
最终得到pattern [classpath*:cn/zno/s1/**/*.class]
再扫描得到spring bean
resolver 的作用就是化繁为简,将简单的经过解析翻译成为最终需要的
全路径
二、视图解析器
what is a resolver的更多相关文章
- AutoMapper:Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type
异常处理汇总-后端系列 http://www.cnblogs.com/dunitian/p/4523006.html 应用场景:ViewModel==>Mode映射的时候出错 AutoMappe ...
- Asp.Net Web API 2第十一课——在Web API中使用Dependency Resolver
前言 阅读本文之前,您也可以到Asp.Net Web API 2 系列导航进行查看 http://www.cnblogs.com/aehyok/p/3446289.html 本文主要来介绍在Asp.N ...
- 秒杀 ILSpy 等反编译利器 DotNet Resolver
http://dotnetresolver.eu5.org/downloads.html DotNet Resolver is a free .NET decompiler written in C# ...
- SPRING IN ACTION 第4版笔记-第六章Rendering web views-001- Spring支持的View Resolver、InternalResourceViewResolver、JstlView
一.Spring支持的View Resolver 二.InternalResourceViewResolver Spring supports JSP views in two ways: Inte ...
- Web API中使用Dependency Resolver
Web API中使用Dependency Resolver 前言 阅读本文之前,您也可以到Asp.Net Web API 2 系列导航进行查看 http://www.cnblogs.com/aehyo ...
- Angular2 - Starter - Routes, Route Resolver
在基于Angualr的SPA中,路由是一个很重要的部分,它帮助我们更方便的实现页面上区域的内容的动态加载,不同tab的切换,同时及时更新浏览器地址栏的URN,使浏览器回退和前进能导航到历史访问的页面. ...
- Fix “Could not flush the DNS Resolver Cache: Function failed during execution” When Flushing DNS
ipconfig /flushdns It is possible that you’re getting an error message “Could not flush the DNS Reso ...
- .29-浅析webpack源码之Resolver.prototype.resolve
在上一节中,最后返回了一个resolver,本质上就是一个Resolver对象: resolver = new Resolver(fileSystem); 这个对象的构造函数非常简单,只是简单的继承了 ...
- from dns.resolver import Resolver ImportError: No module named dns.resolver
from dns.resolver import Resolver ImportError: No module named dns.resolver python2运行BBScan时提示: from ...
- io.netty.resolver.dns.DnsNameResolverContext
java.net.UnknownHostException: failed to resolve 'xxx.com' after 3 queries at io.netty.resolver.dns. ...
随机推荐
- 定时器NSTimer
/** 添加定时器 */@property (nonatomic, strong) NSTimer *timer; - (void)addTimer{ // 2秒后,自己 调用nextImage方法 ...
- 线特征---LBD算法(三)
上一节主要是介绍LSD算法理论,这节主要是介绍LBD算法. 参考文章:An efficient and robust line segment matching approach based on L ...
- mysql-mysqldump命令导出多个数据库结构(实战)
环境:windows server 2012 打开CMD命令行模式, >cd c:\Program Files\Mysql\Mysql 5.7.1\bin c:\Program Files\My ...
- auth 认证模块
. auth认证模块: http://www.cnblogs.com/liwenzhou/p/9030211.html auth模块的知识点: . 创建超级用户 python manage.py cr ...
- 团队合作之项目NABCD
小组组长 :毛松林 组员 :张浩,谢诗语 N 我们小组要开发的项目是“高校自习室查询APP”,作为一个大学生,自学是一件很重要的能力,大学的老师不可能还像高中的老师那样整天逼着你学习,爱学不学,不学 ...
- PAT 甲级 1011 World Cup Betting (20)(代码+思路)
1011 World Cup Betting (20)(20 分) With the 2010 FIFA World Cup running, football fans the world over ...
- HDU_2112(最短路)
经过锦囊相助,海东集团终于度过了危机,从此,HDU的发展就一直顺风顺水,到了2050年,集团已经相当规模了,据说进入了钱江肉丝经济开发区500强.这时候,XHD夫妇也退居了二线,并在风景秀美的诸暨市浬 ...
- spring batch遇到的一些问题
1.Spring Batch - A job instance already exists: JobInstanceAlreadyCompleteException 这是因为JobParameter ...
- TP 真阳性 TN FP FN
TP.True Positive 真阳性:预测为正,实际也为正 FP.False Positive 假阳性:预测为正,实际为负 FN.False Negative 假阴性:预测与负.实际为正 T ...
- libpcap 库使用(一)
参考资料: http://www.tcpdump.org/ DESCRIPTION The Packet Capture library provides a high level interface ...