- 浏览: 1134858 次
- 性别:
- 来自: 上海
-
文章分类
- 全部博客 (1055)
- quartz定时任务 (1)
- json (9)
- 接口 (1)
- http (1)
- sccket (2)
- xmlbean (1)
- webservice (1)
- flex (1)
- sitemesh (2)
- json组装 (2)
- 存储过程 (6)
- ajax后台返回前台上下问 (3)
- flect反射机制 (1)
- 页面列表 (1)
- oracal结果集合并 (1)
- lucene (1)
- 读取配置文件工具 (1)
- 框架整合 (1)
- jms (3)
- 断点续传 (1)
- 页面之间的传值 (1)
- jpa (6)
- sql (8)
- jsp跳转 (1)
- jsp (6)
- jquery (2)
- ui (1)
- js与jsp之间的值的交互应用 (1)
- js空值判断 (1)
- Ajax (9)
- web-inf 编译目录 (1)
- 多线程 (9)
- 资料 (0)
- oracal (4)
- 多线程webservice (1)
- ztree (1)
- 加载与内容的变化 (1)
- 页面的公用变量 (1)
- web-inf目录结构 (1)
- 登陆系列 (1)
- jass应用于webservice认证 (2)
- 路径问题 (1)
- list合并 (1)
- list map中的value获取 (2)
- 标签tag (4)
- 方法 (1)
- 树形数据及其渲染 (1)
- require js 回调 (1)
- tab 页面切换 (2)
- 计时获取验证码 (1)
- 模式 (6)
- easyui (3)
- dialog (2)
- 乱码问题 (1)
- spring (29)
- sqlserver (1)
- iis,netframework (0)
- iis (1)
- netframework (1)
- 处理乱码问题 (1)
- struts-ajax (0)
- ,理论,了;,; (0)
- 排错方法 (1)
- hibernate (1)
- 二级缓存 (1)
- portal (1)
- date类型 (0)
- jvm out of memery StackOverflowError (1)
- echart数据填充 (0)
- echart (1)
- jmv (1)
- 学习 (0)
- java基础 (1)
- oracle性能优化 (1)
- 数据库三范式 (1)
- easy UI (1)
- oracle11g (1)
- form (3)
- servlet (2)
- spring mvc (1)
- htm5 (0)
- ibatise (1)
- 序列化 (1)
- tomcat双认证 (1)
- maven Lib (1)
- tomcat eclipse (2)
- ehcache (1)
- http 代替 ajax (2)
- rest (6)
- script脚本占位模板 (1)
- strust 标签 el表达式 (1)
- js bo (1)
- 公司资料 (0)
- js return (1)
- spring 第三方插件的工具类 (1)
- linux (10)
- linux 克隆 (1)
- linux xshell连接 (1)
- yum expect (1)
- linux 应用命令 (1)
- yum 缓存rmp包 (1)
- yum 本地库离线安装 (2)
- yum错误 (1)
- jsp页面用定时调用 (1)
- ajax setup (2)
- Exception,RuntimeException (1)
- 对话框 dialog (1)
- maven (17)
- PropertyPlaceholderConfigurer properties文件 (1)
- 错误集 (1)
- mybatise (0)
- 拦截器filter (1)
- http get post 区别 (1)
- rest 客户端两种返回的数据处理方式 (1)
- listener (2)
- maven工程 (1)
- ContainerResponseFilter (1)
- ajax action 打印任意实体类jsp (1)
- yum svn mvn (1)
- 分页 (1)
- angularjs (1)
- memcached (1)
- git (12)
- yyyyyyyy (0)
- oracal安装 (4)
- jaxwswebservice (1)
- spring bean (1)
- 排方法 (0)
- java 生成pdf (2)
- 创建目录 (1)
- 下载与生产pdf文件 (1)
- base64 (2)
- 配置文件 (2)
- blob (1)
- pdf (1)
- yum linux 安装Oracle (1)
- excl 插入数据库 (1)
- 搭建框架 (1)
- .classpath和jdk jre (1)
- mybatise 配置文件通配 (1)
- 用Maven插件生成Mybatis代码 (2)
- springmvc值的传递 (1)
- js jsp html (1)
- ajax跨域 (1)
- javamail (0)
- 提交复杂格式json数据 (1)
- get中文乱码/post (1)
- 弹出框,承载弹出链接----页面,显示大图 (1)
- @RequestBody list bean (1)
- 隐藏域 (1)
- 多页保存 (1)
- form 校验 (1)
- 注册,上传图片 (1)
- 登录验证 (1)
- 全局的异常处理 (0)
- 异常捕获,显示在页面 (0)
- mybatise事物配置 (1)
- maven compile (1)
- 时间格式 (1)
- js 跳转页面 (1)
- pringsecurity 角色授资源要重启服务 (0)
- Retrofi restfull (1)
- session过期推出,直接点击退出,退出 (0)
- 参数放于requestbody (1)
- maven本地仓库jar包 (1)
- 编译环境出错jdk1.6 1,7 (1)
- jsonarray ---json数组格式 (1)
- java后台文件上传,接受的2种方式 (0)
- 生成保存图片 (1)
- 权限mysql数据库Md5加密sql (1)
- mysql一对多关联查询 (1)
- mysql批量更新 (0)
- oracle in exists 区别 (1)
- https (1)
- linux发布脚本 (1)
- dubbo zookeepr (1)
- request.getParameter() (1)
- request.setAttribute() (1)
- @RequestMapping @ResponseBody (1)
- @RequestMapping @responsebody src控件 后台如何写入src值 (1)
- dwz (8)
- lib jar maven (1)
- web服务访问名称 (1)
- mvc返回内容设置,拦截 (1)
- @ResponseBody 返回json处理 (1)
- 视图,函数,存储过程 (1)
- <context:annotation-config/> (1)
- <context:component-scan/> (1)
- xml路劲通配 (2)
- 杂项 (1)
- dubbo (34)
- redis (25)
- mybatis (34)
- springmvc (15)
- js (7)
- sprinvmvc (1)
- 设计理念 (1)
- 工程 (1)
- 其他 (149)
- 导出,下载 (1)
- session (4)
- token (1)
- Exception处理 (2)
- 注解 (2)
- 框架 (3)
- shrio (1)
- login (1)
- 项目结构设计 (1)
- mybatis两种关联查询 (1)
- mybaits (2)
- 迭代模式 (1)
- oralce树形数据结构构建 (2)
- 树形结构的jsp展现 (1)
- filter intecept(Struts) (1)
- 树形结构数据的提交 (1)
- @RequestBody @RequestParam (1)
- div (1)
- equals重写 (1)
- 程序设计 (1)
- f多层for循环跳出 (1)
- 看源码 (0)
- 权限系统普遍通性 (1)
- 设计程序 (1)
- 动态拼接元素样式问题 (1)
- sql迭代 (1)
- debug断点 (1)
- spring mvc 扫描注解(ioc (1)
- di) (1)
- jdk (2)
- cglib (1)
- mybatis 多层括号(超过三层)解析不了 (1)
- tiles (2)
- cacheManager缓存的切换 (1)
- jsp,xml中el表达式等占位符中的数据操作 (1)
- jpa 及spring data jpa开发 (1)
- compareTo equals toString (1)
- 子页面用父页面js (1)
- jsp相对路径自加问题 (1)
- bean之间的相互拷贝 (1)
- DECODE (2)
- 泛型 (2)
- NVL (1)
- jsp jstl函数 用标签声明页面变量,供jstl使用,时间格式问题 (1)
- form表单切换action值 (1)
- response.getWriter().write()功能优于springMvc的返回 (1)
- 快速复制构建项目 (1)
- activeMq (15)
- cache (2)
- sql获取序列号 (1)
- 上传 (2)
- tfs (1)
- jsp标签 (2)
- qita (1)
- 触发器 (1)
- Exception (1)
- mybais (1)
- 标签 (1)
- connect by (1)
- for ... in (1)
- map转化为list (1)
- 树形结构list构建(树形实体) (1)
- 左侧菜单的设计 (1)
- response.getWriter().write() (1)
- eclipse打断点之后断无效 (1)
- 直接访问/web-inf/下的页面 (1)
- clob (1)
- freemark (1)
- 框架的设计 (1)
- get方式处理乱码 (1)
- Request的getParameter和getAttribute方法的区别 (1)
- cas (9)
- 时间格式问题 (1)
- ResponseUtil.writeToResponse (1)
- 树形数据的反选 (1)
- spring data jpa (1)
- jsp异常提示 (1)
- jquery js (1)
- eclipse (1)
- 乱码 (1)
- Json OBJETC (1)
- PROCEDURE (1)
- pl/sql oracle (1)
- 设计 (1)
- el表达式 (3)
- iframe (1)
- map (1)
- jsp中调用Java (1)
- response.getWriter().write() ajax (1)
- mybatis xml 传入参数 (0)
- response与request在返回时作用区别 (1)
- spring cache (1)
- 模型驱动 (1)
- 关于mybatis传空值的处理 (1)
- 日志配置 (1)
- mapper (1)
- mapper mybatis (1)
- mapper mybatis-spring spring-data-jpa (1)
- js插件 (1)
- spring-data-jpa (2)
- 字节流转化过程 (1)
- 数据库 (11)
- jsp页面 (1)
- 局域网络访问问题 (1)
- plsql (2)
- response (1)
- plsq (1)
- Proxool (1)
- cas security (1)
- 系统配置化 (1)
- 集群 (4)
- springboot (24)
- 设计模式 (5)
- 通知 (1)
- 架构 (48)
- zookeeper (5)
- mvc框架 (1)
- 事物隔离策略 (1)
- jvm (8)
- 调研 (1)
- Java工具类 (1)
- 并发容器 (3)
- 多线程管理器 (4)
- 简历 (0)
- 查询 (1)
- 集群工具 (1)
- springMcv (1)
- ConcurrentHashMap (1)
- hashtable (1)
- cac (1)
- 树形结构 (1)
- 定时任务 (1)
- tortoiseGit (2)
- struts (11)
- shiro (31)
- log4j (3)
- struts2 (2)
- 编码 (1)
- request (3)
- Nginx (14)
- tomcat (1)
- idea (12)
- mvc (2)
- BeanUtils (2)
- image (1)
- mino (1)
- httpClient (1)
- volecity (1)
- swagger (3)
- 调错 (0)
- data (1)
- log (1)
- shell (1)
- 事物 (3)
- junit (1)
- RestTemplate (2)
- 线程 (0)
- Exception异常处理 (1)
- Exception异常注解 (1)
- lock (1)
- HashMap (1)
- 面试 (0)
- rabbitMq (1)
- rainCat (1)
- 其它 (1)
- activemq消息传送机制以及ACK机制详解 (0)
- mysql (7)
- fildder (1)
- UML (1)
- 校验 (1)
- 反射 (1)
- 切面 (1)
- springioc (1)
- urule2 (0)
- skywalking (1)
- urule (2)
- docker (2)
- 前端 (1)
- bootstrap (1)
- eureka (2)
- springcloud (16)
- jenkins (2)
- springsecurity (1)
- 数据结构 (4)
- gradle (1)
- mycat (3)
- nacos (1)
- canary (1)
- 线程池 (1)
- solr (1)
- resteasy (2)
- BI (1)
- dfs (2)
- elasticsearch (1)
- ruby (1)
- logstash (1)
- clickhouse (2)
- davinci (15)
- java (1)
- davinvi (1)
- fastdfs (1)
- vue (1)
- 《将博客搬至CSDN》 (1)
最新评论
-
nizhipeng123:
private SessionFactory sessio ...
用map接收参数的几个注意的问题
http://blog.csdn.net/liufengyinglxj/article/details/8646417(这个比较好)
下面又是一个:
spring提供了强大的Ant模式通配符匹配,从同一个路径能匹配一批资源。
Ant路径通配符支持"?"、"*"、"**",注意通配符匹配不包括目录分隔符“/”。
“?”:匹配一个字符,如"config?.xml"可匹配"config1.xml".
“*”:匹配零个或多个字符串,如“com/*/config.xml”将匹配“cn/feng/config.xml”,但不匹配匹配“com/config.xml”(因为这里匹配的是字符串,如果是目录的话则可以);而“com/config-*.xml”将匹配“com/config-dao.xml”;
"**":匹配路径中的零个或多个目录。如“com/**/config.xml”将匹配“com/config.xml”,也匹配“com/feng/spring/config.xml”;而“com/feng/config-**.xml”将匹配“com/feng/config-dao.xml”,即把“**”当做两个“*”处理。
Spring在加载类路径资源时除了提供前缀“classpath:”的来支持加载一个Resource,还提供一个前缀“classpath*:”来支持加载所有匹配的类路径Resource。
Spring提供了ResourcePatternResolver接口来加载多个Resource.
[java] view plain copy
package com.feng.spring.chapter2.helloworld;
import java.io.IOException;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
public interface ResourcePatternResolver extends ResourceLoader{
String CLASSPATH_ALL_URL_PREFIX = "classpath*:";
Resource[] getResources(String locationPattern) throws IOException;//添加了此方法用来接收多个Resource
}
一、"classpath":用于加载类路径(包括jar包)中的一个且仅一个资源;对于多个匹配的也只返回一个。如果需要多个匹配的则考虑"classpath*."前缀。
[java] view plain copy
package com.feng.spring.chapter2.helloworld;
import java.io.IOException;
import org.junit.Test;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
public class HelloTest {
@Test
public void testClasspathPrefix()throws IOException{
ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();
//只加载一个绝对匹配Resource,且通过ResourceLoader.getResource进行加载
Resource resources=resolver.getResource("classpath:META-INF/INDEX.LIST");
Assert.assertEquals(1, resources.length);
//只加载一个匹配的Resource,且通过ResourceLoader.getResource进行加载
resources = resolver.getResource("classpath:META-INF/*.LIST");
Assert.assertTrue(resources.length == 1);
}
}
二、"classpath*":
用于加载类路径(包括jar包)中所有的匹配的资源。
[java] view plain copy
package com.feng.spring.chapter2.helloworld;
import java.io.IOException;
import javax.annotation.Resource;
import junit.framework.Assert;
import org.junit.Test;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
public class HelloTest {
@Test
public void testClasspathAsteriskPrefix()throws IOException{
ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();
//将加载多个绝对匹配的所有Resource
//将首先通过ClassLoader.getResource("META-INF")加载非模式路径部分
//然后进行遍历模式匹配
Resource[] resources = (Resource[]) resolver.getResources("classpath*:META-INF/INDEX.LIST");
Assert.assertTrue(resources.length > 1);
//将加载多个模式匹配的Resource
resources = (Resource[]) resolver.getResources("classpath*:META-INF/*.LIST");
Assert.assertTrue(resources.length > 1);
}
}
带通配符的classpath使用“ClassLoader”的“Enumeration<URL> getResources(String name)”方法来查找通配符之前的资源,然后通过模式匹配来获取匹配的资源。如“classpath:META-INF/*.LIST”将首先加载通配符之前的目录“META-INF”,然后再遍历路径进行子路径匹配从而获取匹配的资源。
三、"file":加载一个或多个系统中的Resource。如:"file:D/*.txt"将返回D盘下的所有txt文件。
四、无前缀:通过ResourceLoader实现加载一个资源。
ApplicationContext提供的getResource方法将获取资源委托给ResourcePatternResolver实现,默认使用PathMatingResourcePatternResolver.
相关推荐
Java使用路径通配符加载Resource与profiles配置使用详解 本文主要介绍了Java使用路径通配符加载Resource与profiles配置使用详解。通过示例代码,详细介绍了Java使用路径通配符加载Resource与profiles配置的使用方法...
2. **使用通配符**:当路径中包含通配符(如`**/*`)时,Spring将尝试加载所有匹配的配置文件。例如: - 如果配置文件放在bin目录下的conf文件夹内,使用通配符时,上述代码将会加载bin/conf目录及其所有子目录下...
#### 二、使用通配符加载配置文件 第二种方式是利用通配符(如“*”)来匹配并加载一组配置文件。这种方式特别适用于需要动态加载一类配置文件的场景,比如当有新的配置文件加入时,不需要修改Java代码即可自动加载...
ResourceLoader接口定义了资源加载的策略,而PathMatchingResourcePatternResolver是其一个实现,用于解析包含通配符的资源路径。 接下来,我们讨论BeanFactory和ApplicationContext。BeanFactory是Spring框架的...
这个属性可以指定多个路径,可以使用通配符,例如 `classpath:mapper/*.xml`。这样,MyBatis 将根据这个路径加载对应的配置文件。 2. 使用 MapperScannerConfigurer 进行扫描 在 Spring 配置文件中,我们还可以...
- **4.4 Resource通配符路径**:支持使用通配符加载一组资源,方便进行批量操作。 ### 5. **Spring Expression Language (SpEL)** SpEL是Spring提供的强大表达式语言,用于在运行时查询和操作Bean的属性,以及执行...
- **4.4 Resource通配符路径**:展示了如何使用通配符来加载一组相关的资源。 通过这个教程,读者将能够熟练掌握Spring 3.0的核心特性和最佳实践,从而更好地在实际项目中运用Spring框架,提高开发效率和代码质量...
- **4.4 Resource通配符路径**:探讨了如何使用通配符在Spring中加载资源文件。 8. **Spring表达式语言(SpEL)**: - **5.1 概述**:简述了SpEL的作用和重要性,它是Spring框架中用于在运行时表达和评估表达式的...
- **WildcardClassLoader**:通过通配符加载多个配置文件,如`classpath:applicationContext-*.xml`。 5. **依赖注入(Dependency Injection, DI)** DI是Spring的核心,它通过XML配置或注解方式来实现对象间的...
4. **4.4 Resource通配符路径**:解释了如何使用通配符来匹配和加载多个资源。 **第五章 Spring表达式语言(SpEL)** SpEL是Spring提供的强大表达式语言,用于在运行时查询和操作对象图: 1. **5.1 概述**:简述...
5. **资源管理**:Spring提供了对资源(如文件、数据库连接等)的管理,包括基础知识、内置Resource实现和访问Resource的方法,以及使用Resource通配符路径来灵活地加载资源。 6. **Spring表达式语言(SpEL)**:...
- **4.4 Resource通配符路径**:介绍了使用通配符进行资源查找的方法,增强了资源管理的灵活性。 5. **Spring Expression Language (SpEL)**: - **5.1 概述**:SpEL是Spring提供的强大表达式语言,用于在运行时...
- **实用技巧**:分享访问资源时的一些实用技巧,比如使用通配符路径。 #### 3.4 Resource通配符路径 - **通配符介绍**:解释如何使用通配符来匹配多个资源文件。 - **实例演示**:给出使用通配符路径的具体实例。...
#### 3.4 Resource通配符路径 - **通配符**:支持`*`和`**`两种通配符,分别表示匹配任意单个字符和任意多个字符。 ### 4. Spring 表达式语言 (SpEL) #### 4.1 SpEL基础 - **概念**:Spring Expression Language,...
4.7.2. Application context构造器中资源路径的通配符 4.7.3. FileSystemResource 说明 5. 校验,数据绑定,BeanWrapper,与属性编辑器 5.1. 简介 5.2. 使用Spring的Validator接口进行校验 5.3. 从错误代码到...
4.7.2. Application context构造器中资源路径的通配符 4.7.3. FileSystemResource 说明 5. 校验,数据绑定,BeanWrapper,与属性编辑器 5.1. 简介 5.2. 使用Spring的Validator接口进行校验 5.3. 从错误代码到...
- **Resource通配符路径:** 提供了类似于Ant风格的路径模式匹配,用于访问多个资源。 ### 5. Spring表达式语言(SpEL) - **SpEL概述:** 简介了SpEL的用途以及基本语法。 - **SpEL基础与语法:** 详细解释了SpEL...
当尝试在AngularJS应用中使用`ng-src`指令加载跨域`iframe`时,如果URL没有被标记为可信,就会出现“Blocked loading resource from url not allowed by $sceDelegate policy”的错误。这是因为`ng-src`会使用`$sce`...
接着,在使用 `electron-packager` 打包时,需要添加 `--extra-resource` 参数,指向之前在 `package.json` 中定义的资源目录。例如,这里的 `--extra-resource='./extraResources'` 就是告诉打包工具将这个目录内的...