Spring框架下自带了丰富的工具类,在我们开发时可以简化很多工作:
1.Resource访问文件资源:
具体有:ResourceUtils.getFile(url);
FileSystemResource(); ClassPathResource();
ServletContextResource(application,url);
2.文件操作 FileCopyUtils
具体有:FileCopyUtils.copy(Resource.getFile,new File(Resource.getFile(),getParent()+'目标文件名'));
3.属性文件操作 PropertiesLoaderUtils
具体有: PropertiesLoaderUtils.loadAllProperties("属性文件名"); --基于类路径
4.EncodedResource(Resource对象,"UTF-8") 编码资源(特殊的);
5.WebApplicationContextUtils
6.WebUtils
具体有:getCookie, getSessionAttribute, getRealPath;
7.StringEscapeutils 编码解码