spring给我们提供了很多的工具类, 应该在我们的日常工作中很好的利用起来. 它可以大大的减轻我们的平时编写代码的长度. 因我们只想用spring的工具类,

而不想把一个大大的spring工程给引入进来. 下面是我从spring3.0.5里抽取出来的工具类.

在最后给出我提取出来的spring代码打成的jar包

spring的里的resouce的概念, 在我们处理io时很有用. 具体信息请参考spring手册

内置的resouce类型

  1. UrlResource
  2. ClassPathResource
  3. FileSystemResource
  4. ServletContextResource
  5. InputStreamResource
  6. ByteArrayResource
  7. EncodedResource 也就是Resource加上encoding, 可以认为是有编码的资源
  8. VfsResource(在jboss里经常用到, 相应还有 工具类 VfsUtils)
  9. org.springframework.util.xml.ResourceUtils 用于处理表达资源字符串前缀描述资源的工具. 如: "classpath:". 
    有 getURL, getFile, isFileURL, isJarURL, extractJarFileURL

工具类

  1. org.springframework.core.annotation.AnnotationUtils   处理注解
  2. org.springframework.core.io.support.PathMatchingResourcePatternResolver  用 于处理 ant 匹配风格(com/*.jsp, com/**/*.jsp),找出所有的资源, 结合上面的resource的概念一起使用,对于遍历文件很有用. 具体请详细查看javadoc
  3. org.springframework.core.io.support.PropertiesLoaderUtils 加载Properties资源工具类,和Resource结合
  4. org.springframework.core.BridgeMethodResolver  桥接方法分析器.  关于桥接方法请参考: http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.12.4.5
  5. org.springframework.core.GenericTypeResolver  范型分析器, 在用于对范型方法, 参数分析.
  6. org.springframework.core.NestedExceptionUtils

xml工具

  1. org.springframework.util.xml.AbstractStaxContentHandler
  2. org.springframework.util.xml.AbstractStaxXMLReader
  3. org.springframework.util.xml.AbstractXMLReader
  4. org.springframework.util.xml.AbstractXMLStreamReader
  5. org.springframework.util.xml.DomUtils
  6. org.springframework.util.xml.SimpleNamespaceContext
  7. org.springframework.util.xml.SimpleSaxErrorHandler
  8. org.springframework.util.xml.SimpleTransformErrorListener
  9. org.springframework.util.xml.StaxUtils
  10. org.springframework.util.xml.TransformerUtils

其它工具集

  1. org.springframework.util.xml.AntPathMatcherant风格的处理
  2. org.springframework.util.xml.AntPathStringMatcher
  3. org.springframework.util.xml.Assert断言,在我们的参数判断时应该经常用
  4. org.springframework.util.xml.CachingMapDecorator
  5. org.springframework.util.xml.ClassUtils用于Class的处理
  6. org.springframework.util.xml.CollectionUtils用于处理集合的工具
  7. org.springframework.util.xml.CommonsLogWriter
  8. org.springframework.util.xml.CompositeIterator
  9. org.springframework.util.xml.ConcurrencyThrottleSupport
  10. org.springframework.util.xml.CustomizableThreadCreator
  11. org.springframework.util.xml.DefaultPropertiesPersister
  12. org.springframework.util.xml.DigestUtils摘要处理, 这里有用于md5处理信息的
  13. org.springframework.util.xml.FileCopyUtils文件的拷贝处理, 结合Resource的概念一起来处理, 真的是很方便
  14. org.springframework.util.xml.FileSystemUtils
  15. org.springframework.util.xml.LinkedCaseInsensitiveMap
    key值不区分大小写的LinkedMap
  16. org.springframework.util.xml.LinkedMultiValueMap一个key可以存放多个值的LinkedMap
  17. org.springframework.util.xml.Log4jConfigurer一个log4j的启动加载指定配制文件的工具类
  18. org.springframework.util.xml.NumberUtils处理数字的工具类, 有parseNumber 可以把字符串处理成我们指定的数字格式, 还支持format格式, convertNumberToTargetClass 可以实现Number类型的转化.
  19. org.springframework.util.xml.ObjectUtils有很多处理null object的方法. 如nullSafeHashCode, nullSafeEquals, isArray, containsElement, addObjectToArray, 等有用的方法
  20. org.springframework.util.xml.PatternMatchUtilsspring里用于处理简单的匹配. 如 Spring's typical "xxx*", "*xxx" and "*xxx*" pattern styles
  21. org.springframework.util.xml.PropertyPlaceholderHelper用于处理占位符的替换
  22. org.springframework.util.xml.ReflectionUtils反映常用工具方法. 有 findField, setField, getField, findMethod, invokeMethod等有用的方法
  23. org.springframework.util.xml.SerializationUtils用于java的序列化与反序列化. serialize与deserialize方法
  24. org.springframework.util.xml.StopWatch一个很好的用于记录执行时间的工具类, 且可以用于任务分阶段的测试时间. 最后支持一个很好看的打印格式. 这个类应该经常用
  25. org.springframework.util.xml.StringUtils
  26. org.springframework.util.xml.SystemPropertyUtils
  27. org.springframework.util.xml.TypeUtils用于类型相容的判断. isAssignable
  28. org.springframework.util.xml.WeakReferenceMonitor弱引用的监控

和web相关的工具

    1. org.springframework.web.util.CookieGenerator
    2. org.springframework.web.util.HtmlCharacterEntityDecoder
    3. org.springframework.web.util.HtmlCharacterEntityReferences
    4. org.springframework.web.util.HtmlUtils
    5. org.springframework.web.util.HttpUrlTemplate
      这个类用于用字符串模板构建url, 它会自动处理url里的汉字及其它相关的编码. 在读取别人提供的url资源时, 应该经常用 
      String url = "http://localhost/myapp/{name}/{id}"
    6. org.springframework.web.util.JavaScriptUtils
    7. org.springframework.web.util.Log4jConfigListener
      用listener的方式来配制log4j在web环境下的初始化
    8. org.springframework.web.util.UriTemplate
    9. org.springframework.web.util.UriUtils处理uri里特殊字符的编码
    10. org.springframework.web.util.WebUtils
    11. org.springframework.web.util.

spring常用的工具类的更多相关文章

  1. Spring 的优秀工具类盘点

    文件资源操作 文件资源的操作是应用程序中常见的功能,如当上传一个文件后将其保存在特定目录下,从指定地址加载一个配置文件等等.我们一般使用 JDK 的 I/O 处理类完成这些操作,但对于一般的应用程序来 ...

  2. Spring的StringUtils工具类

    本文是转载文章,感觉比较好,如有侵权,请联系本人,我将及时删除. 原文网址:<Spring的StringUtils工具类> org.springframework.util.StringU ...

  3. Spring 的优秀工具类盘点第 2 部分

    特殊字符转义 由于 Web 应用程序需要联合使用到多种语言,每种语言都包含一些特殊的字符,对于动态语言或标签式的语言而言,如果需要动态构造语言的内容时,一个我们经常会碰到的问题就是特殊字符转义的问题. ...

  4. Spring 的优秀工具类盘点---转

    第 1 部分: 文件资源操作和 Web 相关工具类 http://www.ibm.com/developerworks/cn/java/j-lo-spring-utils1/ 文件资源操作 文件资源的 ...

  5. Android常用的工具类

    主要介绍总结的Android开发中常用的工具类,大部分同样适用于Java.目前包括HttpUtils.DownloadManagerPro.ShellUtils.PackageUtils. Prefe ...

  6. Android常用的工具类(转)

    主要介绍总结的Android开发中常用的工具类,大部分同样适用于Java.目前包括HttpUtils.DownloadManagerPro.ShellUtils.PackageUtils.Prefer ...

  7. 2013最新Android常用的工具类整理

    主要介绍总结的Android开发中常用的工具类,大部分同样适用于Java. 目前包括HttpUtils.DownloadManagerPro.ShellUtils.PackageUtils. Pref ...

  8. Spring获取bean工具类,可用于在线程里面获取bean

    Spring获取bean工具类,可用于在线程里面获取bean import java.util.Locale; import org.springframework.beans.BeansExcept ...

  9. Java语言Lang包下常用的工具类介绍_java - JAVA

    文章来源:嗨学网 敏而好学论坛www.piaodoo.com 欢迎大家相互学习 无论你在开发哪中 Java 应用程序,都免不了要写很多工具类/工具函数.你可知道,有很多现成的工具类可用,并且代码质量都 ...

随机推荐

  1. java面试每日一题10

    题目:利用递归方法求5! public class Recursion { public static void main(String args[]) throws NumberFormatExce ...

  2. [lua]lua简介

    在这篇文章中,我想向大家介绍如何进行Lua程序设计.我假设大家都学过至少一门编程语言,比如Basic或C,特别是C.因为Lua的最大用途是在宿主程序中作为脚本使用的. Lua 的语法比较简单,学习起来 ...

  3. 移动端web出现的一系列问题

    今天做移动端的web,在做后期处理的时候,发现了非常多的问题.下面我分别列举一下吧~~ 1.移动端浏览器众多,各种浏览器之间的显示等都有差异,很多需要单独处理,于是我需要判断分别是什么浏览器.js代码 ...

  4. 周赛-Colored Sticks 分类: 比赛 2015-08-02 09:33 7人阅读 评论(0) 收藏

    Colored Sticks Time Limit: 5000MS Memory Limit: 128000K Total Submissions: 32423 Accepted: 8556 Desc ...

  5. Encoding 分类: HDU 2015-06-25 21:56 9人阅读 评论(0) 收藏

    Encoding Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...

  6. 判断sql执行效率以及针对临时表的使用

    /****** Script for SelectTopNRows command from SSMS ******/ SET STATISTICS io ON SET STATISTICS time ...

  7. 2016年10月30日 星期日 --出埃及记 Exodus 19:15

    2016年10月30日 星期日 --出埃及记 Exodus 19:15 Then he said to the people, "Prepare yourselves for the thi ...

  8. ubuntu16.04 搭建 Mysql服务器

    ubuntu16.04 安装 mysql5.7 ,并配置远程访问 安装mysql及其可选组件 apt-get install mysql-serverapt-get install mysql-cli ...

  9. php获取汉字的拼音 拼音首字母

    /***获取汉字的拼音*/function pinyin($s, $isfirst = false) { static $pinyins; $s = trim($s); $len = strlen($ ...

  10. SqlSever基础 datepart 获取一个日期的年份

    镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...