Spring常用工具类

  1. 内置的resouce类型   
  2. UrlResource  
  3. ClassPathResource  
  4. FileSystemResource  
  5. ServletContextResource  
  6. InputStreamResource  
  7. ByteArrayResource  
  8. EncodedResource 也就是Resource加上encoding, 可以认为是有编码的资源  
  9. VfsResource(在jboss里经常用到, 相应还有 工具类 VfsUtils)  
  10. org.springframework.util.xml.ResourceUtils 用于处理表达资源字符串前缀描述资源的工具. 如: "classpath:".   
  11. 有 getURL, getFile, isFileURL, isJarURL, extractJarFileURL   
  12. 工具类   
  13. org.springframework.core.annotation.AnnotationUtils   处理注解  
  14. org.springframework.core.io.support.PathMatchingResourcePatternResolver  用于处理 ant 匹配风格(com/*.jsp, com/**/*.jsp),找出所有的资源, 结合上面的resource的概念一起使用,对于遍历文件很有用. 具体请详细查看javadoc  
  15. org.springframework.core.io.support.PropertiesLoaderUtils 加载Properties资源工具类,和Resource结合  
  16. org.springframework.core.BridgeMethodResolver  桥接方法分析器.  关于桥接方法请参考: http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.12.4.5  
  17. org.springframework.core.GenericTypeResolver  范型分析器, 在用于对范型方法, 参数分析.  
  18. org.springframework.core.NestedExceptionUtils  
  19.   
  20.   
  21. xml工具   
  22. org.springframework.util.xml.AbstractStaxContentHandler  
  23. org.springframework.util.xml.AbstractStaxXMLReader  
  24. org.springframework.util.xml.AbstractXMLReader  
  25. org.springframework.util.xml.AbstractXMLStreamReader  
  26. org.springframework.util.xml.DomUtils  
  27. org.springframework.util.xml.SimpleNamespaceContext  
  28. org.springframework.util.xml.SimpleSaxErrorHandler  
  29. org.springframework.util.xml.SimpleTransformErrorListener  
  30. org.springframework.util.xml.StaxUtils  
  31. org.springframework.util.xml.TransformerUtils    
  32. 其它工具集   
  33. org.springframework.util.xml.AntPathMatcherant风格的处理  
  34. org.springframework.util.xml.AntPathStringMatcher  
  35. org.springframework.util.xml.Assert断言,在我们的参数判断时应该经常用  
  36. org.springframework.util.xml.CachingMapDecorator  
  37. org.springframework.util.xml.ClassUtils用于Class的处理  
  38. org.springframework.util.xml.CollectionUtils用于处理集合的工具  
  39. org.springframework.util.xml.CommonsLogWriter  
  40. org.springframework.util.xml.CompositeIterator  
  41. org.springframework.util.xml.ConcurrencyThrottleSupport  
  42. org.springframework.util.xml.CustomizableThreadCreator  
  43. org.springframework.util.xml.DefaultPropertiesPersister  
  44. org.springframework.util.xml.DigestUtils摘要处理, 这里有用于md5处理信息的  
  45. org.springframework.util.xml.FileCopyUtils文件的拷贝处理, 结合Resource的概念一起来处理, 真的是很方便  
  46. org.springframework.util.xml.FileSystemUtils  
  47. org.springframework.util.xml.LinkedCaseInsensitiveMap ,key值不区分大小写的LinkedMap  
  48. org.springframework.util.xml.LinkedMultiValueMap一个key可以存放多个值的LinkedMap  
  49. org.springframework.util.xml.Log4jConfigurer一个log4j的启动加载指定配制文件的工具类  
  50. org.springframework.util.xml.NumberUtils处理数字的工具类, 有parseNumber 可以把字符串处理成我们指定的数字格式, 还支持format格式, convertNumberToTargetClass 可以实现Number类型的转化.   
  51. org.springframework.util.xml.ObjectUtils有很多处理null object的方法. 如nullSafeHashCode, nullSafeEquals, isArray, containsElement, addObjectToArray, 等有用的方法  
  52. org.springframework.util.xml.PatternMatchUtilsspring里用于处理简单的匹配. 如 Spring's typical "xxx*", "*xxx" and "*xxx*" pattern styles  
  53. org.springframework.util.xml.PropertyPlaceholderHelper用于处理占位符的替换  
  54. org.springframework.util.xml.ReflectionUtils反映常用工具方法. 有 findField, setField, getField, findMethod, invokeMethod等有用的方法  
  55. org.springframework.util.xml.SerializationUtils用于java的序列化与反序列化. serialize与deserialize方法  
  56. org.springframework.util.xml.StopWatch一个很好的用于记录执行时间的工具类, 且可以用于任务分阶段的测试时间. 最后支持一个很好看的打印格式. 这个类应该经常用  
  57. org.springframework.util.xml.StringUtils  
  58. org.springframework.util.xml.SystemPropertyUtils  
  59. org.springframework.util.xml.TypeUtils用于类型相容的判断. isAssignable  
  60. org.springframework.util.xml.WeakReferenceMonitor弱引用的监控   
  61. 和web相关的工具   
  62. org.springframework.web.util.CookieGenerator  
  63. org.springframework.web.util.HtmlCharacterEntityDecoder  
  64. org.springframework.web.util.HtmlCharacterEntityReferences  
  65. org.springframework.web.util.HtmlUtils  
  66. org.springframework.web.util.HttpUrlTemplate  
  67. 这个类用于用字符串模板构建url, 它会自动处理url里的汉字及其它相关的编码. 在读取别人提供的url资源时, 应该经常用  
 
 

 

  1. String url = "http://localhost/myapp/{name}/{id}"  
  2. org.springframework.web.util.JavaScriptUtils  
  3. org.springframework.web.util.Log4jConfigListener <span style="font-family: Arial, Helvetica, sans-serif;">用listener的方式来配制log4j在web环境下的初始化</span>  
 
 
  1. org.springframework.web.util.UriTemplate  
  2. org.springframework.web.util.UriUtils处理uri里特殊字符的编码  
  3. org.springframework.web.util.WebUtils  
  4. org.springframework.web.util.  
posted @ 2017-12-22 15:50  长风Jsonol  阅读(151)  评论(0编辑  收藏  举报