国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

編程小知識(shí)【java-0009】java常用開發(fā)庫(kù)-Spring工具類

2023-06-14 08:06 作者:退役程序員老馬  | 我要投稿

Spring作為常用的開發(fā)框架,在Spring框架應(yīng)用中,排在ApacheCommon,Guava, Huool等通用庫(kù)后,第二優(yōu)先級(jí)可以考慮使用Spring-core-xxx.jar中的util包。

內(nèi)置Resource類型

  • org.springframework.core.io.UrlResource:訪問網(wǎng)絡(luò)資源

  • org.springframework.core.io.ClassPathResource:訪問類路徑下資源

  • org.springframework.core.io.FileSystemResource:訪問文件系統(tǒng)資源

  • org.springframework.web.context.support.ServletContextResource:訪問相關(guān)Web應(yīng)用程序根目錄中的相對(duì)路徑

  • org.springframework.core.io.InputStreamResource:輸入流的Resource實(shí)現(xiàn)類,一般在沒有特定的資源實(shí)現(xiàn)的時(shí)候使用

  • org.springframework.core.io.ByteArrayResource:字節(jié)數(shù)組的Resource實(shí)現(xiàn)類

  • org.springframework.core.io.support.EncodedResource :就是Resource加上encoding, 可以認(rèn)為是有編碼的資源。當(dāng)您使用 Resource 實(shí)現(xiàn)類加載文件資源時(shí),它默認(rèn)采用操作系統(tǒng)的編碼格式。如果文件資源采用了特殊的編碼格式(如 UTF-8),則在讀取資源內(nèi)容時(shí)必須事先通過 EncodedResource 指定編碼格式,否則將會(huì)產(chǎn)生中文亂碼的問題。

  • org.springframework.core.io.VfsResource:在jboss里經(jīng)常用到, 相應(yīng)還有 工具類 VfsUtils

  • org.springframework.util.ResourceUtils:它支持“classpath:”和“file:”的地址前綴,它能夠從指定的地址加載文件資源,常用方法:getFile()

常用工具類

  • org.springframework.util.Assert:斷言工具類,通常用于數(shù)據(jù)合法性檢查

  • org.springframework.core.annotation.AnnotationUtils:處理注解

  • org.springframework.web.context.support.WebApplicationContextUtils:獲取spring應(yīng)用的上下文,即 WebApplicationContext 對(duì)象

  • org.springframework.web.bind.ServletRequestUtils:web請(qǐng)求工具類,主要功能是用來從請(qǐng)求中解析被綁定的參數(shù)

  • org.springframework.util.FileCopyUtils:文件的拷貝處理,提供了許多一步式的靜態(tài)操作方法,能夠?qū)⑽募?nèi)容拷貝到一個(gè)目標(biāo) byte[]、String 甚至一個(gè)輸出流或輸出文件中

  • org.springframework.core.io.support.PropertiesLoaderUtils:允許您直接通過基于類路徑的文件地址加載屬性資源

  • org.springframework.util.StringUtils:字符串工具類

  • org.springframework.util.CollectionUtils:集合工具類

  • org.springframework.util.NumberUtils:處理數(shù)字工具類

  • org.springframework.util.SerializationUtils:對(duì)象序列化與反序列化

  • org.springframework.util.DigestUtils:MD5加密

  • org.springframework.util.PatternMatchUtils:處理簡(jiǎn)單的匹配

  • org.springframework.util.PropertyPlaceholderHelper:處理占位符的替換

  • org.springframework.util.ReflectionUtils:反射常用工具方法. 有 findField, setField, getField, findMethod, invokeMethod等有用的方法

  • org.springframework.util.StopWatch一個(gè)很好的用于記錄執(zhí)行時(shí)間的工具類, 且可以用于任務(wù)分階段的測(cè)試時(shí)間


編程小知識(shí)【java-0009】java常用開發(fā)庫(kù)-Spring工具類的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
措美县| 收藏| 东光县| 江口县| 都江堰市| 通化县| 平武县| 曲沃县| 铜梁县| 绍兴市| 宁化县| 芦溪县| 万山特区| 甘泉县| 邓州市| 江川县| 湖北省| 北流市| 巴南区| 嘉善县| 深水埗区| 丰都县| 通榆县| 河津市| 右玉县| 博野县| 闸北区| 聂拉木县| 青铜峡市| 临泽县| 大田县| 保定市| 海淀区| 澎湖县| 湖州市| 苍溪县| 伊宁县| 深圳市| 清苑县| 昌图县| 阳新县|