欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

java操作excel導入導出的3種方式

 更新時間:2023年05月19日 10:33:11   作者:懟懟_bml  
項目需要,要實現(xiàn)一個導入導出excel的功能,于是任務驅動著我學習到了POI、easypoi和easyexcel這3個java操作Excel的工具,下面這篇文章主要給大家介紹了關于java操作excel導入導出的3種方式,需要的朋友可以參考下

一、介紹

在平時的業(yè)務系統(tǒng)開發(fā)中,少不了需要用到導出、導入excel功能,今天我們就一起來總結一下,如果你正為此需求感到困惑,那么閱讀完本文,你一定會有所收獲!

二、poi

大概在很久很久以前,微軟的電子表格軟件 Excel 以操作簡單、存儲數(shù)據(jù)直觀方便,還支持打印報表,在誕生之初,可謂深得辦公室里的白領青睞,極大的提升了工作的效率,不久之后,便成了辦公室里的必備工具。

隨著更多的新語言的崛起,例如我們所熟悉的 java,后來便有一些團隊開始開發(fā)一套能與 Excel 軟件無縫切換的操作工具!

這其中就有我們所熟悉的 apache 的 poi,其前身是 Jakarta 的 POI Project項目,之后將其開源給 apache 基金會!

當然,在java生態(tài)體系里面,能與Excel無縫銜接的第三方工具還有很多,因為 apache poi 在業(yè)界使用的最廣泛,因此其他的工具不做過多介紹!

話不多說,直接開擼!

2.1、首先引入apache poi的依賴

<dependencies>
    <!--xls(03)-->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>4.1.2</version>
    </dependency>
    <!--xlsx(07)-->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>4.1.2</version>
    </dependency>
    <!--時間格式化工具-->
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>2.10.6</version>
    </dependency>
</dependencies>

2.2、導出excel

導出操作,即使用 Java 寫出數(shù)據(jù)到 Excel 中,常見場景是將頁面上的數(shù)據(jù)導出,這些數(shù)據(jù)可能是財務數(shù)據(jù),也可能是商品數(shù)據(jù),生成 Excel 后返回給用戶下載文件。

在 poi 工具庫中,導出 api 可以分三種方式

  • HSSF方式:這種方式導出的文件格式為office 2003專用格式,即.xls,優(yōu)點是導出數(shù)據(jù)速度快,但是最多65536行數(shù)據(jù)
  • XSSF方式:這種方式導出的文件格式為office 2007專用格式,即.xlsx,優(yōu)點是導出的數(shù)據(jù)不受行數(shù)限制,缺點導出速度慢
  • SXSSF方式:SXSSF 是 XSSF API的兼容流式擴展,主要解決當使用 XSSF 方式導出大數(shù)據(jù)量時,內存溢出的問題,支持導出大批量的excel數(shù)據(jù)

2.2.1、HSSF方式導出

HSSF方式,最多只支持65536條數(shù)據(jù)導出,超過這個條數(shù)會報錯!

public class ExcelWrite2003Test {
    public static String PATH = "/Users/hello/Desktop/";
    public static void main(String[] args) throws Exception {
        //時間
        long begin = System.currentTimeMillis();
        //創(chuàng)建一個工作簿
        Workbook workbook = new HSSFWorkbook();
        //創(chuàng)建表
        Sheet sheet = workbook.createSheet();
        //寫入數(shù)據(jù)
        for (int rowNumber = 0; rowNumber < 65536; rowNumber++) {
            //創(chuàng)建行
            Row row = sheet.createRow(rowNumber);
            for (int cellNumber = 0; cellNumber < 10; cellNumber++) {
                //創(chuàng)建列
                Cell cell = row.createCell(cellNumber);
                cell.setCellValue(cellNumber);
            }
        }
        System.out.println("over");
        FileOutputStream fileOutputStream = new FileOutputStream(PATH + "用戶信息表2003BigData.xls");
        workbook.write(fileOutputStream);
        fileOutputStream.close();
        long end = System.currentTimeMillis();
        System.out.println((double) (end - begin) / 1000);//4.29s
    }
}

2.2.2、XSSF方式導出

XSSF方式支持大批量數(shù)據(jù)導出,所有的數(shù)據(jù)先寫入內存再導出,容易出現(xiàn)內存溢出!

public class ExcelWrite2007Test {
    public static String PATH = "/Users/hello/Desktop/";
    public static void main(String[] args) throws Exception {
        //時間
        long begin = System.currentTimeMillis();
        //創(chuàng)建一個工作簿
        Workbook workbook = new XSSFWorkbook();
        //創(chuàng)建表
        Sheet sheet = workbook.createSheet();
        //寫入數(shù)據(jù)
        for (int rowNumber = 0; rowNumber < 65537; rowNumber++) {
            Row row = sheet.createRow(rowNumber);
            for (int cellNumber = 0; cellNumber < 10; cellNumber++) {
                Cell cell = row.createCell(cellNumber);
                cell.setCellValue(cellNumber);
            }
        }
        System.out.println("over");
        FileOutputStream fileOutputStream = new FileOutputStream(PATH + "用戶信息表2007BigData.xlsx");
        workbook.write(fileOutputStream);
        fileOutputStream.close();
        long end = System.currentTimeMillis();
        System.out.println((double) (end - begin) / 1000);//15.87s
    }
}

2.2.3、SXSSF方式導出

SXSSF方式是XSSF方式的一種延伸,主要特性是低內存,導出的時候,先將數(shù)據(jù)寫入磁盤再導出,避免報內存不足,導致程序運行異常,缺點是運行很慢!

public class ExcelWriteSXSSFTest {
    public static String PATH = "/Users/hello/Desktop/";
    public static void main(String[] args) throws Exception {
        //時間
        long begin = System.currentTimeMillis();
        //創(chuàng)建一個工作簿
        Workbook workbook = new SXSSFWorkbook();
        //創(chuàng)建表
        Sheet sheet = workbook.createSheet();
        //寫入數(shù)據(jù)
        for (int rowNumber = 0; rowNumber < 100000; rowNumber++) {
            Row row = sheet.createRow(rowNumber);
            for (int cellNumber = 0; cellNumber < 10; cellNumber++) {
                Cell cell = row.createCell(cellNumber);
                cell.setCellValue(cellNumber);
            }
        }
        System.out.println("over");
        FileOutputStream fileOutputStream = new FileOutputStream(PATH + "用戶信息表2007BigDataS.xlsx");
        workbook.write(fileOutputStream);
        fileOutputStream.close();
        long end = System.currentTimeMillis();
        System.out.println((double) (end - begin) / 1000);//6.39s
    }
}

2.3、導入excel

導入操作,即將 excel 中的數(shù)據(jù)采用java工具庫將其解析出來,進而將 excel 數(shù)據(jù)寫入數(shù)據(jù)庫!

同樣,在 poi 工具庫中,導入 api 也分三種方式,與上面的導出一一對應!

2.3.1、HSSF方式導入

public class ExcelRead2003Test {
    public static String PATH = "/Users/hello/Desktop/";
    public static void main(String[] args) throws Exception {
        //獲取文件流
        FileInputStream inputStream = new FileInputStream(PATH + "用戶信息表BigData.xls");
        //1.創(chuàng)建工作簿,使用excel能操作的這邊都看看操作
        Workbook workbook = new HSSFWorkbook(inputStream);
        //2.得到表
        Sheet sheet = workbook.getSheetAt(0);
        //3.得到行
        Row row = sheet.getRow(0);
        //4.得到列
        Cell cell = row.getCell(0);
        getValue(cell);
        inputStream.close();
    }
    public static void getValue(Cell cell){
        //匹配類型數(shù)據(jù)
        if (cell != null) {
            CellType cellType = cell.getCellType();
            String cellValue = "";
            switch (cellType) {
                case STRING: //字符串
                    System.out.print("[String類型]");
                    cellValue = cell.getStringCellValue();
                    break;
                case BOOLEAN: //布爾類型
                    System.out.print("[boolean類型]");
                    cellValue = String.valueOf(cell.getBooleanCellValue());
                    break;
                case BLANK: //空
                    System.out.print("[BLANK類型]");
                    break;
                case NUMERIC: //數(shù)字(日期、普通數(shù)字)
                    System.out.print("[NUMERIC類型]");
                    if (HSSFDateUtil.isCellDateFormatted(cell)) { //日期
                        System.out.print("[日期]");
                        Date date = cell.getDateCellValue();
                        cellValue = new DateTime(date).toString("yyyy-MM-dd");
                    } else {
                        //不是日期格式,防止數(shù)字過長
                        System.out.print("[轉換為字符串輸出]");
                        cell.setCellType(CellType.STRING);
                        cellValue = cell.toString();
                    }
                    break;
                case ERROR:
                    System.out.print("[數(shù)據(jù)類型錯誤]");
                    break;
            }
            System.out.println(cellValue);
        }
    }
}

2.3.2、XSSF方式導入

public class ExcelRead2007Test {
    public static String PATH = "/Users/hello/Desktop/";
    public static void main(String[] args) throws Exception {
        //獲取文件流
        FileInputStream inputStream = new FileInputStream(PATH + "用戶信息表2007BigData.xlsx");
        //1.創(chuàng)建工作簿,使用excel能操作的這邊都看看操作
        Workbook workbook = new XSSFWorkbook(inputStream);
        //2.得到表
        Sheet sheet = workbook.getSheetAt(0);
        //3.得到行
        Row row = sheet.getRow(0);
        //4.得到列
        Cell cell = row.getCell(0);
        getValue(cell);
        inputStream.close();
    }
    public static void getValue(Cell cell){
        //匹配類型數(shù)據(jù)
        if (cell != null) {
            CellType cellType = cell.getCellType();
            String cellValue = "";
            switch (cellType) {
                case STRING: //字符串
                    System.out.print("[String類型]");
                    cellValue = cell.getStringCellValue();
                    break;
                case BOOLEAN: //布爾類型
                    System.out.print("[boolean類型]");
                    cellValue = String.valueOf(cell.getBooleanCellValue());
                    break;
                case BLANK: //空
                    System.out.print("[BLANK類型]");
                    break;
                case NUMERIC: //數(shù)字(日期、普通數(shù)字)
                    System.out.print("[NUMERIC類型]");
                    if (HSSFDateUtil.isCellDateFormatted(cell)) { //日期
                        System.out.print("[日期]");
                        Date date = cell.getDateCellValue();
                        cellValue = new DateTime(date).toString("yyyy-MM-dd");
                    } else {
                        //不是日期格式,防止數(shù)字過長
                        System.out.print("[轉換為字符串輸出]");
                        cell.setCellType(CellType.STRING);
                        cellValue = cell.toString();
                    }
                    break;
                case ERROR:
                    System.out.print("[數(shù)據(jù)類型錯誤]");
                    break;
            }
            System.out.println(cellValue);
        }
    }
}

2.3.3、SXSSF方式導入

public class ExcelReadSXSSFTest {
    public static String PATH = "/Users/hello/Desktop/";
    public static void main(String[] args) throws Exception {
        //獲取文件流
        //1.創(chuàng)建工作簿,使用excel能操作的這邊都看看操作
        OPCPackage opcPackage = OPCPackage.open(PATH + "用戶信息表2007BigData.xlsx");
        XSSFReader xssfReader = new XSSFReader(opcPackage);
        StylesTable stylesTable = xssfReader.getStylesTable();
        ReadOnlySharedStringsTable sharedStringsTable = new ReadOnlySharedStringsTable(opcPackage);
        // 創(chuàng)建XMLReader,設置ContentHandler
        XMLReader xmlReader = SAXHelper.newXMLReader();
        xmlReader.setContentHandler(new XSSFSheetXMLHandler(stylesTable, sharedStringsTable, new SimpleSheetContentsHandler(), false));
        // 解析每個Sheet數(shù)據(jù)
        Iterator<InputStream> sheetsData = xssfReader.getSheetsData();
        while (sheetsData.hasNext()) {
            try (InputStream inputStream = sheetsData.next();) {
                xmlReader.parse(new InputSource(inputStream));
            }
        }
    }
    /**
     * 內容處理器
     */
    public static class SimpleSheetContentsHandler implements XSSFSheetXMLHandler.SheetContentsHandler {
        protected List<String> row;
        /**
         * A row with the (zero based) row number has started
         *
         * @param rowNum
         */
        @Override
        public void startRow(int rowNum) {
            row = new ArrayList<>();
        }
        /**
         * A row with the (zero based) row number has ended
         *
         * @param rowNum
         */
        @Override
        public void endRow(int rowNum) {
            if (row.isEmpty()) {
                return;
            }
            // 處理數(shù)據(jù)
            System.out.println(row.stream().collect(Collectors.joining("   ")));
        }
        /**
         * A cell, with the given formatted value (may be null),
         * and possibly a comment (may be null), was encountered
         *
         * @param cellReference
         * @param formattedValue
         * @param comment
         */
        @Override
        public void cell(String cellReference, String formattedValue, XSSFComment comment) {
            row.add(formattedValue);
        }
        /**
         * A header or footer has been encountered
         *
         * @param text
         * @param isHeader
         * @param tagName
         */
        @Override
        public void headerFooter(String text, boolean isHeader, String tagName) {
        }
    }
}

三、easypoi

easypoi 的底層也是基于 apache poi 進行深度開發(fā)的,它主要的特點就是將更多重復的工作,全部簡單化,避免編寫重復的代碼!

3.1、首先添加依賴包

<dependencies>
    <dependency>
        <groupId>cn.afterturn</groupId>
        <artifactId>easypoi-base</artifactId>
        <version>4.1.0</version>
    </dependency>
    <dependency>
        <groupId>cn.afterturn</groupId>
        <artifactId>easypoi-web</artifactId>
        <version>4.1.0</version>
    </dependency>
    <dependency>
        <groupId>cn.afterturn</groupId>
        <artifactId>easypoi-annotation</artifactId>
        <version>4.1.0</version>
    </dependency>
</dependencies>

3.2、采用注解導出導入

easypoi 最大的亮點就是基于注解實體類來導出、導入excel,使用起來非常簡單!

首先,我們創(chuàng)建一個實體類UserEntity,其中@Excel注解表示導出文件的頭部信息。

public class UserEntity {
    @Excel(name = "姓名")
    private String name;
    @Excel(name = "年齡")
    private int age;
    @Excel(name = "操作時間",format="yyyy-MM-dd HH:mm:ss", width = 20.0)
    private Date time;
 //set、get省略
}

接著,我們來編寫導出服務!

public static void main(String[] args) throws Exception {
    List<UserEntity> dataList = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
        UserEntity userEntity = new UserEntity();
        userEntity.setName("張三" + i);
        userEntity.setAge(20 + i);
        userEntity.setTime(new Date(System.currentTimeMillis() + i));
        dataList.add(userEntity);
    }
    //生成excel文檔
    Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("用戶","用戶信息"),
            UserEntity.class, dataList);
    FileOutputStream fos = new FileOutputStream("/Users/hello/Documents/easypoi-user1.xls");
    workbook.write(fos);
    fos.close();
}

導出的文件預覽如下:

對應的導入操作,也很簡單,源碼如下:

public static void main(String[] args) {
    ImportParams params = new ImportParams();
    params.setTitleRows(1);
    params.setHeadRows(1);
    long start = new Date().getTime();
    List<StudentEntity> list = ExcelImportUtil.importExcel(new File("/Users/hello/Documents/easypoi-user1.xls"),
            UserEntity.class, params);
    System.out.println(new Date().getTime() - start);
    System.out.println(JSONArray.toJSONString(list));
}

運行程序,輸出結果如下:

[{"age":20,"name":"張三0","time":1616919493000},{"age":21,"name":"張三1","time":1616919493000},{"age":22,"name":"張三2","time":1616919493000},{"age":23,"name":"張三3","time":1616919493000},{"age":24,"name":"張三4","time":1616919493000},{"age":25,"name":"張三5","time":1616919493000},{"age":26,"name":"張三6","time":1616919493000},{"age":27,"name":"張三7","time":1616919493000},{"age":28,"name":"張三8","time":1616919493000},{"age":29,"name":"張三9","time":1616919493000}]

3.3、自定義數(shù)據(jù)結構導出導入

easypoi 同樣也支持自定義數(shù)據(jù)結構導出導入excel。

  • 自定義數(shù)據(jù)導出 excel
public static void main(String[] args) throws Exception {
    //封裝表頭
    List<ExcelExportEntity> entityList = new ArrayList<ExcelExportEntity>();
    entityList.add(new ExcelExportEntity("姓名", "name"));
    entityList.add(new ExcelExportEntity("年齡", "age"));
    ExcelExportEntity entityTime = new ExcelExportEntity("操作時間", "time");
    entityTime.setFormat("yyyy-MM-dd HH:mm:ss");
    entityTime.setWidth(20.0);
    entityList.add(entityTime);
    //封裝數(shù)據(jù)體
    List<Map<String, Object>> dataList = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
        Map<String, Object> userEntityMap = new HashMap<>();
        userEntityMap.put("name", "張三" + i);
        userEntityMap.put("age", 20 + i);
        userEntityMap.put("time", new Date(System.currentTimeMillis() + i));
        dataList.add(userEntityMap);
    }
    //生成excel文檔
    Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("學生","用戶信息"), entityList, dataList);
    FileOutputStream fos = new FileOutputStream("/Users/panzhi/Documents/easypoi-user2.xls");
    workbook.write(fos);
    fos.close();
}
  • 導入 excel
public static void main(String[] args) {
    ImportParams params = new ImportParams();
    params.setTitleRows(1);
    params.setHeadRows(1);
    long start = new Date().getTime();
    List<Map<String, Object>> list = ExcelImportUtil.importExcel(new File("/Users/panzhi/Documents/easypoi-user2.xls"),
            Map.class, params);
    System.out.println(new Date().getTime() - start);
    System.out.println(JSONArray.toJSONString(list));
}

更多的 api 操作可以訪問 Easypoi - 接口文檔

四、easyexcel

easyexcel 是阿里巴巴開源的一款 excel 解析工具,底層邏輯也是基于 apache poi 進行二次開發(fā)的。不同的是,再讀寫數(shù)據(jù)的時候,采用 sax 模式一行一行解析,在并發(fā)量很大的情況下,依然能穩(wěn)定運行!

下面,我們就一起來了解一下這款新起之秀!

4.1、首先添加依賴包

<dependencies>
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>easyexcel</artifactId>
        <version>2.2.6</version>
    </dependency>
 <!--常用工具庫-->
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>29.0-jre</version>
    </dependency>
</dependencies>

4.2、采用注解導出導入

easyexcel 同樣也支持采用注解方式進行導出、導入!

首先,我們創(chuàng)建一個實體類UserEntity,其中@ExcelProperty注解表示導出文件的頭部信息。

public class UserEntity {
    @ExcelProperty(value = "姓名")
    private String name;
    @ExcelProperty(value = "年齡")
    private int age;
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = "操作時間")
    private Date time;
    //set、get省略
}

接著,我們來編寫導出服務!

public static void main(String[] args) {
    List<UserEntity> dataList = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
        UserEntity userEntity = new UserEntity();
        userEntity.setName("張三" + i);
        userEntity.setAge(20 + i);
        userEntity.setTime(new Date(System.currentTimeMillis() + i));
        dataList.add(userEntity);
    }
    EasyExcel.write("/Users/hello/Documents/easyexcel-user1.xls", UserEntity.class).sheet("用戶信息").doWrite(dataList);
}

導出的文件預覽如下:

對應的導入操作,也很簡單,源碼如下:

public static void main(String[] args) {
    String filePath = "/Users/hello/Documents/easyexcel-user1.xls";
    List<DemoData> list = EasyExcel.read(filePath).head(UserEntity.class).sheet().doReadSync();
    System.out.println(JSONArray.toJSONString(list));
}

運行程序,輸出結果如下:

[{"age":20,"name":"張三0","time":1616920360000},{"age":21,"name":"張三1","time":1616920360000},{"age":22,"name":"張三2","time":1616920360000},{"age":23,"name":"張三3","time":1616920360000},{"age":24,"name":"張三4","time":1616920360000},{"age":25,"name":"張三5","time":1616920360000},{"age":26,"name":"張三6","time":1616920360000},{"age":27,"name":"張三7","time":1616920360000},{"age":28,"name":"張三8","time":1616920360000},{"age":29,"name":"張三9","time":1616920360000}]

4.3、自定義數(shù)據(jù)結構導出導入

easyexcel 同樣也支持自定義數(shù)據(jù)結構導出導入excel。

  • 自定義數(shù)據(jù)導出 excel
public static void main(String[] args) {
    //表頭
    List<List<String>> headList = new ArrayList<>();
    headList.add(Lists.newArrayList("姓名"));
    headList.add(Lists.newArrayList("年齡"));
    headList.add(Lists.newArrayList("操作時間"));
    //數(shù)據(jù)體
    List<List<Object>> dataList = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
        List<Object> data = new ArrayList<>();
        data.add("張三" + i);
        data.add(20 + i);
        data.add(new Date(System.currentTimeMillis() + i));
        dataList.add(data);
    }
    EasyExcel.write("/Users/hello/Documents/easyexcel-user2.xls").head(headList).sheet("用戶信息").doWrite(dataList);
}
  • 導入 excel
public static void main(String[] args) {
    String filePath = "/Users/panzhi/Documents/easyexcel-user2.xls";
    UserDataListener userDataListener = new UserDataListener();
    EasyExcel.read(filePath, userDataListener).sheet().doRead();
    System.out.println("表頭:" + JSONArray.toJSONString(userDataListener.getHeadList()));
    System.out.println("數(shù)據(jù)體:" + JSONArray.toJSONString(userDataListener.getDataList()));
}

運行程序,輸出結果如下:

表頭:[{0:"姓名",1:"年齡",2:"操作時間"}]
數(shù)據(jù)體:[{0:"張三0",1:"20",2:"2021-03-28 16:31:39"},{0:"張三1",1:"21",2:"2021-03-28 16:31:39"},{0:"張三2",1:"22",2:"2021-03-28 16:31:39"},{0:"張三3",1:"23",2:"2021-03-28 16:31:39"},{0:"張三4",1:"24",2:"2021-03-28 16:31:39"},{0:"張三5",1:"25",2:"2021-03-28 16:31:39"},{0:"張三6",1:"26",2:"2021-03-28 16:31:39"},{0:"張三7",1:"27",2:"2021-03-28 16:31:39"},{0:"張三8",1:"28",2:"2021-03-28 16:31:39"},{0:"張三9",1:"29",2:"2021-03-28 16:31:39"}]

更多的 api 操作可以訪問 easyexcel - 接口文檔

五、小結

總體來說,easypoi和easyexcel都是基于apache poi進行二次開發(fā)的。

不同點在于:

1、easypoi 在讀寫數(shù)據(jù)的時候,優(yōu)先是先將數(shù)據(jù)寫入內存,優(yōu)點是讀寫性能非常高,但是當數(shù)據(jù)量很大的時候,會出現(xiàn)oom,當然它也提供了 sax 模式的讀寫方式,需要調用特定的方法實現(xiàn)。

2、easyexcel 基于sax模式進行讀寫數(shù)據(jù),不會出現(xiàn)oom情況,程序有過高并發(fā)場景的驗證,因此程序運行比較穩(wěn)定,相對于 easypoi 來說,讀寫性能稍慢!

easypoi 與 easyexcel 還有一點區(qū)別在于,easypoi 對定制化的導出支持非常的豐富,如果當前的項目需求,并發(fā)量不大、數(shù)據(jù)量也不大,但是需要導出 excel 的文件樣式千差萬別,那么我推薦你用 easypoi;反之,使用 easyexcel !

到此這篇關于java操作excel導入導出的3種方式的文章就介紹到這了,更多相關java導入導出excel內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

  • Spring?AOP簡介及統(tǒng)一處理

    Spring?AOP簡介及統(tǒng)一處理

    AOP面向切面編程,它是一種思想,它是對某一類事情的集中處理,本文給大家介紹Spring?AOP簡介及統(tǒng)一處理,感興趣的朋友跟隨小編一起看看吧
    2023-09-09
  • JAVA正則表達式的基本使用教程

    JAVA正則表達式的基本使用教程

    這篇文章主要給大家介紹了關于JAVA正則表達式的基本使用教程,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2021-03-03
  • Spring?Boot+Vue實現(xiàn)Socket通知推送的完整步驟

    Spring?Boot+Vue實現(xiàn)Socket通知推送的完整步驟

    最近工作中涉及消息通知功能的開發(fā),所以下面這篇文章主要給大家介紹了關于Spring?Boot+Vue實現(xiàn)Socket通知推送的完整步驟,文中通過實例代碼以及圖文介紹的非常詳細,需要的朋友可以參考下
    2023-04-04
  • java將圖片至暗的實現(xiàn)方法

    java將圖片至暗的實現(xiàn)方法

    下面小編就為大家?guī)硪黄猨ava將圖片至暗的實現(xiàn)方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-06-06
  • Spring中@Configuration注解的Full模式和Lite模式詳解

    Spring中@Configuration注解的Full模式和Lite模式詳解

    這篇文章主要介紹了Spring中@Configuration注解的Full模式和Lite模式詳解,準確來說,Full?模式和?Lite?模式其實?Spring?容器在處理?Bean?時的兩種不同行為,這兩種不同的模式在使用時候的表現(xiàn)完全不同,今天就來和各位小伙伴捋一捋這兩種模式,需要的朋友可以參考下
    2023-09-09
  • Maven指定JDK版本的實現(xiàn)

    Maven指定JDK版本的實現(xiàn)

    本文主要介紹了Maven指定JDK版本的實現(xiàn),主要有兩種方式,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2023-09-09
  • springcloud中RabbitMQ死信隊列與延遲交換機實現(xiàn)方法

    springcloud中RabbitMQ死信隊列與延遲交換機實現(xiàn)方法

    死信隊列是消息隊列中非常重要的概念,同時我們需要業(yè)務場景中都需要延遲發(fā)送的概念,比如12306中的30分鐘后未支付訂單取消,那么本期,我們就來講解死信隊列,以及如何通過延遲交換機來實現(xiàn)延遲發(fā)送的需求,感興趣的朋友一起看看吧
    2022-05-05
  • 一文詳解kafka序列化器和攔截器

    一文詳解kafka序列化器和攔截器

    這篇文章主要為大家介紹了kafka序列化器和攔截器使用示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-03-03
  • Java中的Semaphore計數(shù)信號量詳細解析

    Java中的Semaphore計數(shù)信號量詳細解析

    這篇文章主要介紹了Java中的Semaphore計數(shù)信號量詳細解析,Semaphore?是一個計數(shù)信號量,必須由獲取它的線程釋放,常用于限制可以訪問某些資源的線程數(shù)量,例如通過?Semaphore?限流,需要的朋友可以參考下
    2023-11-11
  • SpringBoot增量/瘦身部署jar包的方式

    SpringBoot增量/瘦身部署jar包的方式

    SpringBoot 項目的部署一般采用全量jar 包方式部署相關項目,如果我們對相關的Contrller層進行相關業(yè)務調整就需要重新編譯全量jar 包太麻煩了,所以本文給大家介紹了使用SpringBoot 的增量/瘦身部署方式,需要的朋友可以參考下
    2024-01-01

最新評論