栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

使用JRebel 6.0.0进行部署时,在Spring 4.1.2更新之后找不到资源

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使用JRebel 6.0.0进行部署时,在Spring 4.1.2更新之后找不到资源

该问题已在JRebel中修复 (我无法在当前的JRebel 6.1.1中重现 该问题 )-我猜 自6.0.2起
已修复(2014年12月23日)

修复了Spring ResourceHttpRequestHandler无法为webroot之外的资源提供服务的问题。

(JRebel Changelog
https://zeroturnaround.com/software/jrebel/download/changelog/6-x/)


对于感兴趣的人如何解决它:

我只能猜测,因为这很奇怪。Spring
4.1.6(即我用于测试的版本)的类

org.springframework.web.servlet.resource.PathResourceResolver
具有方法
checkResource(Resourceresource, Resource location)

protected boolean checkResource(Resource resource, Resource location) throws IOException {    if (isResourceUnderLocation(resource, location)) {        return true;    }    if (getAllowedLocations() != null) {        for (Resource current : getAllowedLocations()) { if (isResourceUnderLocation(resource, current)) {     return true; }        }    }    return false;}

第一种

if
isResourceUnderLocation...
检查请求是否正在访问已配置资源文件夹之外的资源的方法

isResourceUnderLocation(Resource resource, Resource location) {    ...    resourcePath = ((ServletContextResource) resource).getPath();    locationPath = StringUtils.cleanPath(((ServletContextResource) location).getPath());    ...    if (!resourcePath.startsWith(locationPath)) {        return false;    }    ... }

当我使用调试器检查JRebel处于活动状态时,发生了什么事情时,发生了一些奇怪的事情:当JVM上线时

if(isResourceUnderLocation(resource, location)){
,该方法
isResourceUnderLocation
就不会被调用!

因此,我得出的结论是,JRebel进行了一些字节码操作,以防止执行检查(以及整个

isResourceUnderLocation
方法)。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/615823.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号