JAVA驗(yàn)證身份證號(hào)碼有效性的實(shí)例代碼
一、身份證結(jié)構(gòu)和形式
在通用的身份證號(hào)碼有15位的和18位的;
15位身份證號(hào)碼各位的含義:
1、1-2位省、自治區(qū)、直轄市代碼;
2、3-4位地級(jí)市、盟、自治州代碼;
3、5-6位縣、縣級(jí)市、區(qū)代碼;
4、7-12位出生年月日,比如670401代表1967年4月1日,與18位的第一個(gè)區(qū)別;
5、13-15位為順序號(hào),其中15位男為單數(shù),女為雙數(shù);
18位身份證號(hào)碼各位的含義:
1、 1-2位表示?。ㄗ灾螀^(qū)、直轄市、特別行政區(qū))。
2、 3-4位表示市(地區(qū)、自治州、盟及國家直轄市所屬市轄區(qū)和縣的匯總碼)。其中,01-20,51-70表示省直轄市;21-50表示地區(qū)(自治州、盟)。
3、 5-6位表示縣(市轄區(qū)、縣級(jí)市、旗)。01-18表示市轄區(qū)或地區(qū)(自治州、盟)轄縣級(jí)市;21-80表示縣(旗);81-99表示省直轄縣級(jí)市。
4、 7-14位【生日期碼】表示編碼對(duì)象出生的年、月、日,其中年份用四位數(shù)字表示,年、月、日之間不用分隔符。例如:1981年05月11日就用19810511表示。
5、 15-17位【順序碼】表示地址碼所標(biāo)識(shí)的區(qū)域范圍內(nèi),對(duì)同年、月、日出生的人員編定的順序號(hào)。其中第十七位奇數(shù)分給男性,偶數(shù)分給女性。
6、 18位【校驗(yàn)碼】,作為尾號(hào)的校驗(yàn)碼,是由號(hào)碼編制單位按統(tǒng)一的公式計(jì)算出來的,如果某人的尾號(hào)是0-9,都不會(huì)出現(xiàn)X,但如果尾號(hào)是10,那么就得用X來代替,因?yàn)槿绻?0做尾號(hào),那么此人的身份證就變成了19位,而19位的號(hào)碼違反了國家標(biāo)準(zhǔn),并且中國的計(jì)算機(jī)應(yīng)用系統(tǒng)也不承認(rèn)19位的身份證號(hào)碼。Ⅹ是羅馬數(shù)字的10,用X來代替10,可以保證公民的身份證符合國家標(biāo)準(zhǔn)。
二、 18位身份證號(hào)碼計(jì)算方法
1、將前面的身份證號(hào)碼17位數(shù)分別乘以不同的系數(shù)。從第一位到第十七位的系數(shù)分別為:7-9-10-5-8-4-2-1-6-3-7-9-10-5-8-4-2。
2、將這17位數(shù)字和系數(shù)相乘的結(jié)果相加。
3、用加出來和除以11,看余數(shù)是多少?
4、余數(shù)只可能有0-1-2-3-4-5-6-7-8-9-10這11個(gè)數(shù)字。其分別對(duì)應(yīng)的最后一位身份證的號(hào)碼為1-0-X -9-8-7-6-5-4-3-2。
5、通過上面得知如果余數(shù)是3,就會(huì)在身份證的第18位數(shù)字上出現(xiàn)的是9。如果對(duì)應(yīng)的數(shù)字是2,身份證的最后一位號(hào)碼就是羅馬數(shù)字x。
例如:某男性的身份證號(hào)碼為【53010219200508011x】, 我們看看這個(gè)身份證是不是合法的身份證。
首先我們得出前17位的乘積和【(57)+(39)+(010)+(15)+(08)+(24)+(12)+(91)+(26)+(03)+(07)+(59)+(010)+(85)+(08)+(14)+(1*2)】是189,然后用189除以11得出的結(jié)果是189/11=17----2,也就是說其余數(shù)是2。最后通過對(duì)應(yīng)規(guī)則就可以知道余數(shù)2對(duì)應(yīng)的檢驗(yàn)碼是X。所以,可以判定這是一個(gè)正確的身份證號(hào)碼。
以上部分內(nèi)容來自百度百科
三、JAVA 校驗(yàn)身份證號(hào)碼
package cn.wje.internationa; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; /** * @author QiFeng·Luo */ public class IdCardUtil { /** * 數(shù)字 */ public final static Pattern NUMBERS = Pattern.compile("\\d+"); /** * 中國公民身份證號(hào)碼最小長度。 */ private static final int CHINA_ID_MIN_LENGTH = 15; /** * 中國公民身份證號(hào)碼最大長度。 */ private static final int CHINA_ID_MAX_LENGTH = 18; public static Exception isValidatedAllIdcard(String idcard) throws Exception { boolean ret = isIdcard(idcard); if (!ret) { throw new Exception("身份證格式有誤"); } return null; } final static Map<Integer, String> zoneNum = new HashMap<>(); /** * 身份證省份編碼 * */ static { zoneNum.put(11, "北京"); zoneNum.put(12, "天津"); zoneNum.put(13, "河北"); zoneNum.put(14, "山西"); zoneNum.put(15, "內(nèi)蒙古"); zoneNum.put(21, "遼寧"); zoneNum.put(22, "吉林"); zoneNum.put(23, "黑龍江"); zoneNum.put(31, "上海"); zoneNum.put(32, "江蘇"); zoneNum.put(33, "浙江"); zoneNum.put(34, "安徽"); zoneNum.put(35, "福建"); zoneNum.put(36, "江西"); zoneNum.put(37, "山東"); zoneNum.put(41, "河南"); zoneNum.put(42, "湖北"); zoneNum.put(43, "湖南"); zoneNum.put(44, "廣東"); zoneNum.put(45, "廣西"); zoneNum.put(46, "海南"); zoneNum.put(50, "重慶"); zoneNum.put(51, "四川"); zoneNum.put(52, "貴州"); zoneNum.put(53, "云南"); zoneNum.put(54, "西藏"); zoneNum.put(61, "陜西"); zoneNum.put(62, "甘肅"); zoneNum.put(63, "青海"); zoneNum.put(64, "寧夏"); zoneNum.put(65, "新疆"); zoneNum.put(71, "臺(tái)灣"); zoneNum.put(81, "香港"); zoneNum.put(82, "澳門"); zoneNum.put(91, "國外"); } /** * 校驗(yàn)碼 */ final static int[] PARITYBIT = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' }; /** * 加權(quán)因子wi */ final static int[] POWER_LIST = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 }; /** * 驗(yàn)證身份證號(hào)有效性 * * @param idCard:身份證號(hào) * @return true/false */ public static boolean isIdcard(String idCard) { // 號(hào)碼長度應(yīng)為15位或18位 if (idCard == null || (idCard.length() != 15 && idCard.length() != 18)) { return false; } // 校驗(yàn)區(qū)位碼 if (!zoneNum.containsKey(Integer.valueOf(idCard.substring(0, 2)))) { return false; } // 校驗(yàn)?zāi)攴? String year = idCard.length() == 15 ? "19" + idCard.substring(6, 8) : idCard.substring(6, 10); final int iyear = Integer.parseInt(year); if (iyear < 1900 || iyear > Calendar.getInstance().get(Calendar.YEAR)) { // 1900年的PASS,超過今年的PASS return false; } // 校驗(yàn)月份 String month = idCard.length() == 15 ? idCard.substring(8, 10) : idCard.substring(10, 12); final int imonth = Integer.parseInt(month); if (imonth < 1 || imonth > 12) { return false; } // 校驗(yàn)天數(shù) String day = idCard.length() == 15 ? idCard.substring(10, 12) : idCard.substring(12, 14); final int iday = Integer.parseInt(day); if (iday < 1 || iday > 31) { return false; } // 校驗(yàn)一個(gè)合法的年月日 if (!isValidDate(year + month + day)) { return false; } // 校驗(yàn)位數(shù) int power = 0; final char[] cs = idCard.toUpperCase().toCharArray(); for (int i = 0; i < cs.length; i++) {// 循環(huán)比正則表達(dá)式更快 if (i == cs.length - 1 && cs[i] == 'X') { break;// 最后一位可以是X或者x } if (cs[i] < '0' || cs[i] > '9') { return false; } if (i < cs.length - 1) { power += (cs[i] - '0') * POWER_LIST[i]; } } // 校驗(yàn)“校驗(yàn)碼” if (idCard.length() == 15) { return true; } return cs[cs.length - 1] == PARITYBIT[power % 11]; } /** * 判斷字符串是否為日期格式(合法) * * @param inDate:字符串時(shí)間 * @return true/false */ public static boolean isValidDate(String inDate) { if (inDate == null) { return false; } // 或yyyy-MM-dd SimpleDateFormat dataFormat = new SimpleDateFormat("yyyyMMdd"); if (inDate.trim().length() != dataFormat.toPattern().length()) { return false; } // 該方法用于設(shè)置Calendar嚴(yán)格解析字符串;默認(rèn)為true,寬松解析 dataFormat.setLenient(false); try { dataFormat.parse(inDate.trim()); } catch (ParseException e) { return false; } return true; } /** * 轉(zhuǎn)換成日期 * @param birthday * @return */ private static Date toBirthDay(String birthday){ try{ Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, Integer.parseInt(birthday.substring(0, 4))); // 月份從0開始,所以減1 calendar.set(Calendar.MONTH, Integer.parseInt(birthday.substring(4, 6)) - 1); calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(birthday.substring(6, 8))); // 以下設(shè)置時(shí)分秒,但是對(duì)生日的意義不大 calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); }catch (Exception e){ return null; } } /** * 給定內(nèi)容是否匹配正則 * * @param pattern 模式 * @param content 內(nèi)容 * @return 正則為null或者""則不檢查,返回true,內(nèi)容為null返回false */ private static boolean isMatch(Pattern pattern, CharSequence content) { if (content == null || pattern == null) { // 提供null的字符串為不匹配 return false; } return pattern.matcher(content).matches(); } /** * 將字符串轉(zhuǎn)換成指定格式的日期 * * @param str 日期字符串. * @param dateFormat 日期格式. 如果為空,默認(rèn)為:yyyy-MM-dd HH:mm:ss. * @return */ private static Date strToDate(final String str, String dateFormat) { if (str == null || str.trim().length() == 0) { return null; } try { if (dateFormat == null || dateFormat.length() == 0) { dateFormat = "yyyy-MM-dd HH:mm:ss"; } DateFormat fmt = new SimpleDateFormat(dateFormat); return fmt.parse(str.trim()); } catch (Exception ex) { return null; } } /** * 根據(jù)日期獲取年 * * @param date 日期 * @return 年的部分 */ public static int year(Date date) { Calendar ca = Calendar.getInstance(); ca.setTime(date); return ca.get(Calendar.YEAR); } /** * 將power和值與11取模獲得余數(shù)進(jìn)行校驗(yàn)碼判斷 * * @param iSum 加權(quán)和 * @return 校驗(yàn)位 */ private static char getCheckCode18(int iSum) { switch (iSum % 11) { case 10: return '2'; case 9: return '3'; case 8: return '4'; case 7: return '5'; case 6: return '6'; case 5: return '7'; case 4: return '8'; case 3: return '9'; case 2: return 'x'; case 1: return '0'; case 0: return '1'; default: return ' '; } } /** * 獲得18位身份證校驗(yàn)碼 * 計(jì)算方式: * 將前面的身份證號(hào)碼17位數(shù)分別乘以不同的系數(shù)。從第一位到第十七位的系數(shù)分別為:7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2 * 將這17位數(shù)字和系數(shù)相乘的結(jié)果相加 * 用加出來和除以11,看余數(shù)是多少 * 余數(shù)只可能有0 1 2 3 4 5 6 7 8 9 10這11個(gè)數(shù)字。其分別對(duì)應(yīng)的最后一位身份證的號(hào)碼為1 0 X 9 8 7 6 5 4 3 2 * 通過上面得知如果余數(shù)是2,就會(huì)在身份證的第18位數(shù)字上出現(xiàn)羅馬數(shù)字的Ⅹ。如果余數(shù)是10,身份證的最后一位號(hào)碼就是2 * @param code17 18位身份證號(hào)中的前17位 * @return 第18位 */ private static char getCheckCode18(String code17) { int sum = getPowerSum(code17.toCharArray()); return getCheckCode18(sum); } /** * 將身份證的每位和對(duì)應(yīng)位的加權(quán)因子相乘之后,再得到和值 * * @param iArr 身份證號(hào)碼的數(shù)組 * @return 身份證編碼 */ private static int getPowerSum(char[] iArr) { int iSum = 0; if (POWER_LIST.length == iArr.length) { for (int i = 0; i < iArr.length; i++) { iSum += Integer.valueOf(String.valueOf(iArr[i])) * POWER_LIST[i]; } } return iSum; } /** * 將15位身份證號(hào)碼轉(zhuǎn)換為18位 * * @param idCard 15位身份編碼 * @return 18位身份編碼 */ public static String convertIdCard(String idCard) { StringBuilder idCard18; if (idCard.length() != CHINA_ID_MIN_LENGTH) { return null; } if (isMatch(NUMBERS, idCard)) { // 獲取出生年月日 String birthday = idCard.substring(6, 12); Date birthDate = strToDate(birthday, "yyMMdd"); // 獲取出生年 int sYear = year(birthDate); // 理論上2000年之后不存在15位身份證,可以不要此判斷 if (sYear > 2000) { sYear -= 100; } idCard18 = new StringBuilder().append(idCard, 0, 6).append(sYear).append(idCard.substring(8)); // 獲取校驗(yàn)位 char sVal = getCheckCode18(idCard18.toString()); idCard18.append(sVal); } else { return null; } return idCard18.toString(); } /** * 從身份證號(hào)碼中獲取生日 * @param idno * @return null表示idno錯(cuò)誤,未獲取到生日 */ public static Date getBirthDay(String idno){ if(!isIdcard(idno)){ return null; } if (idno.length() == 15) { // 如果是15位轉(zhuǎn)為18位 idno = convertIdCard(idno); } return toBirthDay(idno.substring(6, 14)); } /** * 從身份證號(hào)碼中獲取生日 * @param idno * @return null表示idno錯(cuò)誤,未獲取到生日 日期格式為:yyyy-MM-dd */ public static String getBirthDayStr(String idno){ if(!isIdcard(idno)){ return null; } if (idno.length() == 15) { // 如果是15位轉(zhuǎn)為18位 idno = convertIdCard(idno); } Date birthday = toBirthDay(idno.substring(6, 14)); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); return simpleDateFormat.format(birthday); } /** * 從身份證號(hào)中獲取性別 * @param idno * @return 0:男,1:女,-1:證件號(hào)碼錯(cuò)誤 */ public static String getGender(String idno){ if(!isIdcard(idno)){ return "-1"; } if (idno.length() == 15) { // 如果是15位轉(zhuǎn)為18位 idno = convertIdCard(idno); } // 奇男,偶女 return (Integer.parseInt(idno.substring(16, 17)) % 2) == 0 ? "1" : "0"; } /** * 方法調(diào)用測(cè)試 * */ public static void main(String[] args) { String idc= "130503670401001"; //檢查身份證是否合規(guī) boolean idcard = isIdcard(idc); if (idcard) { System.out.println("身份證號(hào)碼合規(guī)"); // 獲取身份證號(hào)碼中的生日 Date birthDay = getBirthDay(idc); System.out.println("當(dāng)前身份證的生日為:"+ getBirthDayStr(idc)); // 獲取性別 String gender = getGender(idc); if ("0".equals(gender)) { System.out.println("當(dāng)前身份證的性別為:男性"); } else if ("1".equals(gender)) { System.out.println("當(dāng)前身份證的性別為:女性"); } else { System.out.println("當(dāng)前身份證格式不正確"); } }else { System.out.println("身份證格式有誤"); } } }
說明:以上工具中 main 方法是用于測(cè)試的,如果放入項(xiàng)目中,不能使用 main 方法測(cè)試,可以使用@Test 注解測(cè)試。此處用 main 方法,只是為了方便貼代碼。
結(jié)果:
補(bǔ)充:java開發(fā)身份證號(hào)校驗(yàn)(邊輸入邊校驗(yàn))
公司最近有個(gè)需求,就是邊輸入邊校驗(yàn)身份證號(hào)碼是否合規(guī)。以往的校驗(yàn)都是輸完夠18位就校驗(yàn),做起來簡單的很,頭一次聽說要求這樣搞的,搞了我一下午。
#代碼利用多個(gè)正則表達(dá)式去校驗(yàn)字符
#判斷年月日校驗(yàn)
#大小月校驗(yàn)
#閏年閏月的校驗(yàn)
####以下就是代碼部分
/** * 功能:身份證的有效驗(yàn)證 * @param idStr 身份證號(hào) * @return true 有效:false 無效 */ public static boolean idCardValidate(String idStr) { try { int index = 1; //第一位不能為0 if (idStr.length() >= index && idStr.indexOf("0") == 0) { return false; } //地區(qū)碼 index++; if (idStr.length() >= index) { Hashtable h = GetAreaCode(); if (h.get(idStr.substring(0, index)) == null) { //errorInfo = "身份證地區(qū)編碼錯(cuò)誤。"; return false; } } // 年份 index = 6; //第一位只能是1和2 if (!verify(idStr, index, "[1,2]")) { return false; } index++; //第二位跟隨第一位只有9或0 if (!verify(idStr, index,idStr.length()>index && idStr.substring(6,7).equals("1")?"[9]":"[0]")) { return false; } index++; //第三位 千禧年后0-?,千禧年前0-9 if (!verify(idStr, index,idStr.length()>index && idStr.substring(6,7).equals("1")?"[0-9]":"[0-2]")) { return false; } index++; //第三位 0-9 if (!verify(idStr, index, "[0-9]")) { return false; } if (idStr.length() > index) { //是否比當(dāng)前年份大 SimpleDateFormat ydf = new SimpleDateFormat("yyyy"); if (ydf.parse(idStr.substring(6, 10)).getTime() > new Date().getTime()) { return false; } } // 月份 index++; //第一位只能是1和0 if (!verify(idStr, index, "[0,1]")) { return false; } index++; //第二位跟隨第一位變化 if (!verify(idStr, index, idStr.length()>index && idStr.substring(index-1,index).equals("1")?"[0-2]":"[1-9]")) { return false; } if (idStr.length() > index) { //是否比當(dāng)前月份大 SimpleDateFormat ydf = new SimpleDateFormat("yyyyMM"); if (ydf.parse(idStr.substring(6, 12)).getTime() > new Date().getTime() && verifyMonth(idStr.substring(10, 12))) { return false; } } // ================ 日份 ================ index++; //第一位 二月最多是2 if (!verify(idStr, index, idStr.length()>index && (dayMonth(idStr.substring(10, 12)) == 2)?"[0-2]":"[0-3]")) { return false; } index++; if (idStr.length()>index) { int ten = Integer.parseInt(idStr.substring(index-1, index));//上一位 String filter = "[0-9]"; switch (dayMonth(idStr.substring(10, 12))){ case 1://31天 if(ten == 3){ filter = "[0,1]"; } break; case 2://2月 if(ten == 2){ filter = "[0-8]"; int year = Integer.parseInt(idStr.substring(6, 10)); //閏年 if(year%400 == 0 || year%4==0){ filter = "[0-9]"; } } break; case 3://30天 if(ten == 3){ filter = "[0]"; } break; } if(ten == 0){ filter = "[1-9]"; } if(!verifyIndex(idStr,index,filter)){ return false; } } if (idStr.length() > index) { SimpleDateFormat ydf = new SimpleDateFormat("yyyyMMdd"); //是否比當(dāng)前日期大 if (ydf.parse(idStr.substring(6, 14)).getTime() > new Date().getTime()) { return false; } } // 號(hào)碼的長度 String filter = "[0-9]{0,17}"; boolean flag = idStr.matches(filter + (idStr.length() == 18 ? "[0-9,x,X]" : "")); if (!flag) { return false; } } catch (ParseException e) { e.printStackTrace(); return false; } return true; } /** * 驗(yàn)證 * @param text 文本 * @param index 下標(biāo) * @param filter 正則匹配 * @return */ private static boolean verify(String text, int index, String filter) { //是否滿足長度 if (text.length() > index) { return verifyIndex(text, index, filter); } return true; } /** * 驗(yàn)證 * @param text 文本 * @param index 下標(biāo) * @param filter 正則匹配 * @return */ private static boolean verifyIndex(String text, int index, String filter) { String sub = text.substring(index, index + 1); return sub.matches(filter); } private static boolean verifyMonth(String month){ return Integer.parseInt(month)>12; } /** * 大小月、二月 * @return */ private static int dayMonth(String month){ switch (Integer.parseInt(month)){ case 4: case 6: case 9: case 11: return 3; case 2:return 2; default: return 1; } } /** * 功能:設(shè)置地區(qū)編碼 * @return Hashtable 對(duì)象 */ private static Hashtable GetAreaCode() { Hashtable hashtable = new Hashtable(); hashtable.put("11", "北京"); hashtable.put("12", "天津"); hashtable.put("13", "河北"); hashtable.put("14", "山西"); hashtable.put("15", "內(nèi)蒙古"); hashtable.put("21", "遼寧"); hashtable.put("22", "吉林"); hashtable.put("23", "黑龍江"); hashtable.put("31", "上海"); hashtable.put("32", "江蘇"); hashtable.put("33", "浙江"); hashtable.put("34", "安徽"); hashtable.put("35", "福建"); hashtable.put("36", "江西"); hashtable.put("37", "山東"); hashtable.put("41", "河南"); hashtable.put("42", "湖北"); hashtable.put("43", "湖南"); hashtable.put("44", "廣東"); hashtable.put("45", "廣西"); hashtable.put("46", "海南"); hashtable.put("50", "重慶"); hashtable.put("51", "四川"); hashtable.put("52", "貴州"); hashtable.put("53", "云南"); hashtable.put("54", "西藏"); hashtable.put("61", "陜西"); hashtable.put("62", "甘肅"); hashtable.put("63", "青海"); hashtable.put("64", "寧夏"); hashtable.put("65", "新疆"); hashtable.put("71", "臺(tái)灣"); hashtable.put("81", "香港"); hashtable.put("82", "澳門"); hashtable.put("91", "國外"); return hashtable; }
總結(jié)
到此這篇關(guān)于JAVA驗(yàn)證身份證號(hào)碼有效性的文章就介紹到這了,更多相關(guān)JAVA身份證號(hào)碼校驗(yàn)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- Java常用正則表達(dá)式驗(yàn)證類完整實(shí)例【郵箱、URL、IP、電話、身份證等】
- java身份證驗(yàn)證代碼實(shí)現(xiàn)
- java身份證合法性校驗(yàn)并提取身份證有效信息
- JAVA 18位身份證號(hào)碼校驗(yàn)碼的算法
- Java身份證驗(yàn)證方法實(shí)例詳解
- Java簡單驗(yàn)證身份證功能示例
- 身份證號(hào)碼驗(yàn)證算法深入研究和Java實(shí)現(xiàn)
- Java身份證號(hào)碼校驗(yàn)工具類詳解
- Java實(shí)現(xiàn)身份證號(hào)碼驗(yàn)證源碼示例分享
- java身份證合法性校驗(yàn)工具類實(shí)例代碼
相關(guān)文章
java基礎(chǔ)教程之拼圖游戲的實(shí)現(xiàn)
拼圖游戲大家應(yīng)該都玩過,下面這篇文章主要給大家介紹了關(guān)于java基礎(chǔ)教程之拼圖游戲的實(shí)現(xiàn)方法,文中通過實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2022-01-01Java中Object.equals和String.equals的區(qū)別詳解
這篇文章主要給大家介紹了Java中Object.equals和String.equals的區(qū)別,文中通過一個(gè)小示例讓大家輕松的明白這兩者的區(qū)別,對(duì)大家具有一定的參考價(jià)值,需要的朋友們下面來一起看看吧。2017-04-04Java操作minio刪除文件夾及其文件方法(MinIO基本使用)
MinIO是一個(gè)高性能、無限擴(kuò)展的開源對(duì)象存儲(chǔ)服務(wù)器,它以對(duì)象的形式存儲(chǔ)數(shù)據(jù),并兼容Amazon S3接口,它適用于大規(guī)模數(shù)據(jù)存儲(chǔ)、大數(shù)據(jù)分析、文件共享和備份等應(yīng)用場(chǎng)景,這篇文章主要介紹了java操作minio刪除文件夾及其文件方法,需要的朋友可以參考下2024-02-02springboot如何連接兩個(gè)數(shù)據(jù)庫(多個(gè))
這篇文章主要介紹了springboot如何連接兩個(gè)數(shù)據(jù)庫(多個(gè)),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-01-01Spring Cloud Hystrix線程池不足的解決方法
這篇文章主要介紹了Spring Cloud Hystrix線程池不足的解決方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-02-02SpringBoot使用SensitiveWord實(shí)現(xiàn)敏感詞過濾
這篇文章主要為大家詳細(xì)介紹了SpringBoot如何使用SensitiveWord實(shí)現(xiàn)敏感詞過濾功能,文中示例代碼講解詳細(xì),感興趣的小伙伴可以了解一下2023-01-01JDK1.8中ConcurrentHashMap中computeIfAbsent死循環(huán)bug問題
這篇文章主要介紹了JDK1.8中ConcurrentHashMap中computeIfAbsent死循環(huán)bug,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-08-08詳解Java實(shí)現(xiàn)批量壓縮圖片裁剪壓縮多種尺寸縮略圖一鍵批量上傳圖片
這篇文章主要介紹了Java實(shí)現(xiàn)批量壓縮圖片裁剪壓縮多種尺寸縮略圖一鍵批量上傳圖片,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-03-03