EasyExcel项目使用

 2.0.5版本做了很大改变,记录2.1.6的所使用的工具类及方法

其实持续对easyexcel的git进行关注是最方便的,上面也有完整的demo以及工具类等等

 1.easyExcel的pom坐标

 <!-- easyexcel --><dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId><version>2.1.6</version></dependency>

2.easyExcel工具类

package com.chinargb.baseadmin.util;import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.exception.ExcelDataConvertException;
import com.alibaba.excel.write.handler.WriteHandler;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;/*** @author: * @date: * @description:*/
public class EasyExcelUtil
{/*** 同步无模型读(默认读取sheet0,从第2行开始读)* @param filePath* @return*/public static List<Map<Integer, String>> syncRead(String filePath){return EasyExcelFactory.read(filePath).sheet().doReadSync();}/*** 同步无模型读(默认表头占一行,从第2行开始读)* @param filePath* @param sheetNo sheet页号,从0开始* @return*/public static List<Map<Integer, String>> syncRead(String filePath, Integer sheetNo){return EasyExcelFactory.read(filePath).sheet(sheetNo).doReadSync();}/*** 同步无模型读(指定sheet和表头占的行数)* @param inputStream* @param sheetNo sheet页号,从0开始* @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)* @return List<Map<colNum, cellValue>>*/public static List<Map<Integer, String>> syncRead(InputStream inputStream, Integer sheetNo, Integer headRowNum){return EasyExcelFactory.read(inputStream).sheet(sheetNo).headRowNumber(headRowNum).doReadSync();}/*** 同步无模型读(指定sheet和表头占的行数)* @param file* @param sheetNo sheet页号,从0开始* @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)* @return List<Map<colNum, cellValue>>*/public static List<Map<Integer, String>> syncRead(File file, Integer sheetNo, Integer headRowNum){return EasyExcelFactory.read(file).sheet(sheetNo).headRowNumber(headRowNum).doReadSync();}/*** 同步无模型读(指定sheet和表头占的行数)* @param filePath* @param sheetNo sheet页号,从0开始* @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)* @return List<Map<colNum, cellValue>>*/public static List<Map<Integer, String>> syncRead(String filePath, Integer sheetNo, Integer headRowNum){return EasyExcelFactory.read(filePath).sheet(sheetNo).headRowNumber(headRowNum).doReadSync();}/*** 同步按模型读(默认读取sheet0,从第2行开始读)* @param filePath* @param clazz 模型的类类型(excel数据会按该类型转换成对象)* @return*/public static List<T> syncReadModel(String filePath, Class clazz){return EasyExcelFactory.read(filePath).sheet().head(clazz).doReadSync();}/*** 同步按模型读(默认表头占一行,从第2行开始读)* @param filePath* @param clazz 模型的类类型(excel数据会按该类型转换成对象)* @param sheetNo sheet页号,从0开始* @return*/public static List<T> syncReadModel(String filePath, Class clazz, Integer sheetNo){return EasyExcelFactory.read(filePath).sheet(sheetNo).head(clazz).doReadSync();}/*** 同步按模型读(指定sheet和表头占的行数)* @param inputStream* @param clazz 模型的类类型(excel数据会按该类型转换成对象)* @param sheetNo sheet页号,从0开始* @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)* @return*/public static List<T> syncReadModel(InputStream inputStream, Class clazz, Integer sheetNo, Integer headRowNum){return EasyExcelFactory.read(inputStream).sheet(sheetNo).headRowNumber(headRowNum).head(clazz).doReadSync();}/*** 同步按模型读(指定sheet和表头占的行数)* @param file* @param clazz 模型的类类型(excel数据会按该类型转换成对象)* @param sheetNo sheet页号,从0开始* @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)* @return*/public static List<T> syncReadModel(File file, Class clazz, Integer sheetNo, Integer headRowNum){return EasyExcelFactory.read(file).sheet(sheetNo).headRowNumber(headRowNum).head(clazz).doReadSync();}/*** 同步按模型读(指定sheet和表头占的行数)* @param filePath* @param clazz 模型的类类型(excel数据会按该类型转换成对象)* @param sheetNo sheet页号,从0开始* @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)* @return*/public static List<T> syncReadModel(String filePath, Class clazz, Integer sheetNo, Integer headRowNum){return EasyExcelFactory.read(filePath).sheet(sheetNo).headRowNumber(headRowNum).head(clazz).doReadSync();}/*** 异步无模型读(默认读取sheet0,从第2行开始读)* @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等* @param filePath 表头占的行数,从0开始(如果要连表头一起读出来则传0)* @return*/public static void asyncRead(String filePath, AnalysisEventListener<T> excelListener){EasyExcelFactory.read(filePath, excelListener).sheet().doRead();}/*** 异步无模型读(默认表头占一行,从第2行开始读)* @param filePath 表头占的行数,从0开始(如果要连表头一起读出来则传0)* @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等* @param sheetNo sheet页号,从0开始* @return*/public static void asyncRead(String filePath, AnalysisEventListener<T> excelListener, Integer sheetNo){EasyExcelFactory.read(filePath, excelListener).sheet(sheetNo).doRead();}/*** 异步无模型读(指定sheet和表头占的行数)* @param inputStream* @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等* @param sheetNo sheet页号,从0开始* @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)* @return*/public static void asyncRead(InputStream inputStream, AnalysisEventListener<T> excelListener, Integer sheetNo, Integer headRowNum){EasyExcelFactory.read(inputStream, excelListener).sheet(sheetNo).headRowNumber(headRowNum).doRead();}/*** 异步无模型读(指定sheet和表头占的行数)* @param file* @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等* @param sheetNo sheet页号,从0开始* @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)* @return*/public static void asyncRead(File file, AnalysisEventListener<T> excelListener, Integer sheetNo, Integer headRowNum){EasyExcelFactory.read(file, excelListener).sheet(sheetNo).headRowNumber(headRowNum).doRead();}/*** 异步无模型读(指定sheet和表头占的行数)* @param filePath* @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等* @param sheetNo sheet页号,从0开始* @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)* @return*/public static void asyncRead(String filePath, AnalysisEventListener<T> excelListener, Integer sheetNo, Integer headRowNum){EasyExcelFactory.read(filePath, excelListener).sheet(sheetNo).headRowNumber(headRowNum).doRead();}/*** 异步按模型读取(默认读取sheet0,从第2行开始读)* @param filePath* @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等* @param clazz 模型的类类型(excel数据会按该类型转换成对象)*/public static void asyncReadModel(String filePath, AnalysisEventListener<T> excelListener, Class clazz){EasyExcelFactory.read(filePath, clazz, excelListener).sheet().doRead();}/*** 异步按模型读取(默认表头占一行,从第2行开始读)* @param filePath* @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等* @param clazz 模型的类类型(excel数据会按该类型转换成对象)* @param sheetNo  sheet页号,从0开始*/public static void asyncReadModel(String filePath, AnalysisEventListener<T> excelListener, Class clazz, Integer sheetNo){EasyExcelFactory.read(filePath, clazz, excelListener).sheet(sheetNo).doRead();}/*** 异步按模型读取* @param inputStream* @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等* @param clazz 模型的类类型(excel数据会按该类型转换成对象)* @param sheetNo  sheet页号,从0开始* @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)*/public static void asyncReadModel(InputStream inputStream, AnalysisEventListener<T> excelListener, Class clazz, Integer sheetNo, Integer headRowNum){EasyExcelFactory.read(inputStream, clazz, excelListener).sheet(sheetNo).headRowNumber(headRowNum).doRead();}/*** 异步按模型读取* @param file* @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等* @param clazz 模型的类类型(excel数据会按该类型转换成对象)* @param sheetNo  sheet页号,从0开始* @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)*/public static void asyncReadModel(File file, AnalysisEventListener<T> excelListener, Class clazz, Integer sheetNo, Integer headRowNum){EasyExcelFactory.read(file, clazz, excelListener).sheet(sheetNo).headRowNumber(headRowNum).doRead();}/*** 异步按模型读取* @param filePath* @param excelListener 监听器,在监听器中可以处理行数据LinkedHashMap,表头数据,异常处理等* @param clazz 模型的类类型(excel数据会按该类型转换成对象)* @param sheetNo  sheet页号,从0开始* @param headRowNum 表头占的行数,从0开始(如果要连表头一起读出来则传0)*/public static void asyncReadModel(String filePath, AnalysisEventListener<T> excelListener, Class clazz, Integer sheetNo, Integer headRowNum){EasyExcelFactory.read(filePath, clazz, excelListener).sheet(sheetNo).headRowNumber(headRowNum).doRead();}/*** 无模板写文件* @param filePath* @param head 表头数据* @param data 表内容数据*/public static void write(String filePath, List<List<String>> head, List<List<Object>> data){EasyExcel.write(filePath).head(head).sheet().doWrite(data);}/*** 无模板写文件* @param filePath* @param head 表头数据* @param data 表内容数据* @param sheetNo sheet页号,从0开始* @param sheetName sheet名称*/public static void write(String filePath, List<List<String>> head, List<List<Object>> data, Integer sheetNo, String sheetName){EasyExcel.write(filePath).head(head).sheet(sheetNo, sheetName).doWrite(data);}/*** 根据excel模板文件写入文件* @param filePath* @param templateFileName* @param headClazz* @param data*/public static void writeTemplate(String filePath, String templateFileName, Class headClazz, List data){EasyExcel.write(filePath, headClazz).withTemplate(templateFileName).sheet().doWrite(data);}/*** 根据excel模板文件写入文件* @param filePath* @param templateFileName* @param data*/public static void writeTemplate(String filePath, String templateFileName, List data){EasyExcel.write(filePath).withTemplate(templateFileName).sheet().doWrite(data);}/*** 按模板写文件* @param filePath* @param headClazz 表头模板* @param data 数据*/public static void write(String filePath, Class headClazz, List data){EasyExcel.write(filePath, headClazz).sheet().doWrite(data);}/*** 按模板写文件* @param filePath* @param headClazz 表头模板* @param data 数据* @param sheetNo sheet页号,从0开始* @param sheetName sheet名称*/public static void write(String filePath, Class headClazz, List data, Integer sheetNo, String sheetName){EasyExcel.write(filePath, headClazz).sheet(sheetNo, sheetName).doWrite(data);}/*** 按模板写文件* @param filePath* @param headClazz 表头模板* @param data 数据* @param writeHandler 自定义的处理器,比如设置table样式,设置超链接、单元格下拉框等等功能都可以通过这个实现(需要注册多个则自己通过链式去调用)* @param sheetNo sheet页号,从0开始* @param sheetName sheet名称*/public static void write(String filePath, Class headClazz, List data, WriteHandler writeHandler, Integer sheetNo, String sheetName){EasyExcel.write(filePath, headClazz).registerWriteHandler(writeHandler).sheet(sheetNo, sheetName).doWrite(data);}/*** 按模板写文件(包含某些字段)* @param filePath* @param headClazz 表头模板* @param data 数据* @param includeCols 过滤包含的字段,根据字段名称过滤* @param sheetNo sheet页号,从0开始* @param sheetName sheet名称*/public static void writeInclude(String filePath, Class headClazz, List data, Set<String> includeCols, Integer sheetNo, String sheetName){EasyExcel.write(filePath, headClazz).includeColumnFiledNames(includeCols).sheet(sheetNo, sheetName).doWrite(data);}/*** 按模板写文件(排除某些字段)* @param filePath* @param headClazz 表头模板* @param data 数据* @param excludeCols 过滤排除的字段,根据字段名称过滤* @param sheetNo sheet页号,从0开始* @param sheetName sheet名称*/public static void writeExclude(String filePath, Class headClazz, List data, Set<String> excludeCols, Integer sheetNo, String sheetName){EasyExcel.write(filePath, headClazz).excludeColumnFiledNames(excludeCols).sheet(sheetNo, sheetName).doWrite(data);}/*** 多个sheet页的数据链式写入* ExcelUtil.writeWithSheets(outputStream)*                 .writeModel(ExcelModel.class, excelModelList, "sheetName1")*                 .write(headData, data,"sheetName2")*                 .finish();* @param outputStream* @return*/public static EasyExcelWriterFactory writeWithSheets(OutputStream outputStream){EasyExcelWriterFactory excelWriter = new EasyExcelWriterFactory(outputStream);return excelWriter;}/*** 多个sheet页的数据链式写入* ExcelUtil.writeWithSheets(file)*                 .writeModel(ExcelModel.class, excelModelList, "sheetName1")*                 .write(headData, data,"sheetName2")*                 .finish();* @param file* @return*/public static EasyExcelWriterFactory writeWithSheets(File file){EasyExcelWriterFactory excelWriter = new EasyExcelWriterFactory(file);return excelWriter;}/*** 多个sheet页的数据链式写入* ExcelUtil.writeWithSheets(filePath)*                 .writeModel(ExcelModel.class, excelModelList, "sheetName1")*                 .write(headData, data,"sheetName2")*                 .finish();* @param filePath* @return*/public static EasyExcelWriterFactory writeWithSheets(String filePath){EasyExcelWriterFactory excelWriter = new EasyExcelWriterFactory(filePath);return excelWriter;}/*** 多个sheet页的数据链式写入(失败了会返回一个有部分数据的Excel)* ExcelUtil.writeWithSheets(response, exportFileName)*                 .writeModel(ExcelModel.class, excelModelList, "sheetName1")*                 .write(headData, data,"sheetName2")*                 .finish();* @param response* @param exportFileName 导出的文件名称* @return*/public static EasyExcelWriterFactory writeWithSheetsWeb(HttpServletResponse response, String exportFileName) throws IOException{response.setContentType("application/vnd.ms-excel");response.setCharacterEncoding("utf-8");// 这里URLEncoder.encode可以防止中文乱码String fileName = URLEncoder.encode(exportFileName, "UTF-8");response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");EasyExcelWriterFactory excelWriter = new EasyExcelWriterFactory(response.getOutputStream());return excelWriter;}
}/*** 默认按模型读取的监听器* @param <T>*/
@Slf4j
class DefaultExcelListener<T> extends AnalysisEventListener<T>
{private final List<T> rows = new ArrayList();@Overridepublic void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {log.info("解析到一条头数据:{}", JSON.toJSONString(headMap));}@Overridepublic void invoke(T object, AnalysisContext context) {rows.add(object);// 实际数据量比较大时,rows里的数据可以存到一定量之后进行批量处理(比如存到数据库),// 然后清空列表,以防止内存占用过多造成OOM}@Overridepublic void doAfterAllAnalysed(AnalysisContext context) {log.info("read {} rows", rows.size());}/*** 在转换异常 获取其他异常下会调用本接口。抛出异常则停止读取。如果这里不抛出异常则 继续读取下一行。* @param exception* @param context* @throws Exception*/@Overridepublic void onException(Exception exception, AnalysisContext context) {log.error("解析失败,但是继续解析下一行:{}", exception.getMessage());if (exception instanceof ExcelDataConvertException) {ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException)exception;log.error("第{}行,第{}列解析异常,数据为:{}", excelDataConvertException.getRowIndex(),excelDataConvertException.getColumnIndex(), excelDataConvertException.getCellData());}}public List<T> getRows() {return rows;}
}

3.EasyExcel工厂类

package com.chinargb.baseadmin.util;import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;import java.io.File;
import java.io.OutputStream;
import java.util.List;/*** 自定义EasyExcel写工厂*/
public class EasyExcelWriterFactory
{private int sheetNo = 0;private ExcelWriter excelWriter = null;public EasyExcelWriterFactory(OutputStream outputStream) {excelWriter = EasyExcel.write(outputStream).build();}public EasyExcelWriterFactory(File file) {excelWriter = EasyExcel.write(file).build();}public EasyExcelWriterFactory(String filePath) {excelWriter = EasyExcel.write(filePath).build();}/*** 链式模板表头写入* @param headClazz 表头格式* @param data 数据 List<ExcelModel> 或者List<List<Object>>* @return*/public EasyExcelWriterFactory writeModel(Class headClazz, List data, String sheetName){excelWriter.write(data, EasyExcel.writerSheet(this.sheetNo++, sheetName).head(headClazz).build());return this;}/*** 链式自定义表头写入* @param head* @param data 数据 List<ExcelModel> 或者List<List<Object>>* @param sheetName* @return*/public EasyExcelWriterFactory write(List<List<String>> head, List data, String sheetName){excelWriter.write(data, EasyExcel.writerSheet(this.sheetNo++, sheetName).head(head).build());return this;}public void finish() {excelWriter.finish();}
}

4.模板模型对象

package com.chinargb.baseadmin.util.excelModel;import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.BaseRowModel;
import lombok.Data;
import lombok.EqualsAndHashCode;/*** excel模型对象*/
@EqualsAndHashCode(callSuper = true)
@Data
public class TableHeaderExcelProperty extends BaseRowModel {/*** value: 表头名称* index: 列的号, 0表示第一列*/@ExcelProperty(value = "姓名", index = 0)private String name;@ExcelProperty(value = "年龄",index = 1)private int age;@ExcelProperty(value = "学校",index = 2)private String school;
}

5.excel导入测试及数据结果

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class BaseAdminApplicationTests {@Testpublic void easyExcelTest() {String FilePath="D:/学生信息.xlsx";List<T> tList = EasyExcelUtil.syncReadModel(FilePath, TableHeaderExcelProperty.class);System.out.println(tList);}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/570928.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

c# vs2010 excel 上传oracle数据

excel 数据表上传到oracle数据库。过程例如以下&#xff1a; 1、打开本地excel文件 2、用OleDb连接excel文件 3、将来excel的数据读取到dataset中 4、把dataset 中数据insert到oracle中对应的表中 以下截图说明&#xff1a; 建立项目文件。非常easy。就是建立普通的winform项目…

SpringBoot编写sh脚本进行启停

SpringBoot项目可以使用内嵌tomcat的jar包启动方式也可以选择war包配置等等进行外置tomcat部署启动 我这里记录一下内嵌tomcat的jar包启动方式及shell脚本 maven clean package 打jar包 本地Java -jar xxx.jar启动测试&#xff0c;如果提示没有主方法入口等问题&#xff0…

Nacos配置文件覆盖问题

近期新项目上cloud alibaba架构 用的注册和配置中心就是用的nacos Nacos作为配置中心给我的感觉也是不是很好用&#xff0c;大概配置中心都不是很好用吧&#xff0c;可能用多了会好点 首先说一下遇到的问题&#xff0c; nacos有几个范围性的概念 我就不说了 1.首先是命名空…

leetCode题解之Reshape the Matrix

1、题目描述 2、分析 使用了一个队列。 3、代码 1 vector<vector<int>> matrixReshape(vector<vector<int>>& nums, int r, int c) {2 3 if( nums.size() * nums[0].size() ! r * c )4 return nums;5 vecto…

项目搭建Nacos及遇到问题解决

新项目决定用SpringCloud Alibaba组件作为基础架构搭建微服务架构 Nacos作为服务注册与发现中心&#xff0c;和eurake有些区别&#xff0c;首先是CAP原则&#xff0c;eurake属于高可用AP&#xff0c;nacos属于一致性CP。 其次eurake的使用是在代码中创建项目并整合入其中&…

Maven3版本的超级POM位置及中央仓库位置

背景 之所以想到这个问题&#xff0c;是因为在配置Nexus-Maven 私服的时候&#xff0c;需要在Maven的settings.xml中对<mirror>进行配置&#xff0c;在配置中央仓库的镜像时&#xff0c;<mirrorOf>需要设置成central&#xff0c;因为这是maven中央仓库的id&#xf…

使用Nacos项目jar包启动抛出的yml异常

记录一下项目jar包启动时一直抛出nacos yml编译错误的问题 一开始抛出yml的问题&#xff0c;是编码问题&#xff0c;但是又不知道Nacos里怎么配置编码格式。 所以我只能把nacos中配置文件里的注释含泪删除调试试看 打包 jar包启动&#xff0c;咦真的少了很多 但是有一个异常…

515Nod 1126 求递推序列的第n项【矩阵快速幂】

有一个序列是这样定义的&#xff1a;f(1) 1, f(2) 1, f(n) (A * f(n - 1) B * f(n - 2)) mod 7.给出A&#xff0c;B和N&#xff0c;求f(n)的值。Input输入3个数&#xff1a;A,B,N。数字之间用空格分割。(-10000 < A, B < 10000, 1 < N < 10^9) Output输出f(n)的…

特殊表情存数据库处理

开发途中遇到评价的功能&#xff0c;需要存入表情符号比如&#xff1a; 以及这种 存入数据库的时候会抛出异常&#xff0c;\x86\啥的 百度解决办法是 数据库改utf8mb4 但是测试改表的字符集并没有用&#xff0c; 然后我也没敢改库的字符集仍然使用utf8 我的解决办法是代码层…

转 【MQTT】在Windows下搭建MQTT服务器

MQTT简介 MQ 遥测传输 (MQTT) 是轻量级基于代理的发布/订阅的消息传输协议&#xff0c;设计思想是开放、简单、轻量、易于实现。这些特点使它适用于受限环境。该协议的特点有&#xff1a; 使用发布/订阅消息模式&#xff0c;提供一对多的消息发布&#xff0c;解除应用程序耦合。…

记录一次StackOverflowError问题

StackOverflowError Idea启动一直抛出StackOverflowError栈溢出&#xff0c;大概率是跟刚写的代码相关 public class WebServiceConfig {private static WebServiceConfig cfg new WebServiceConfig();// Web服务的URLprivate String address;// Web服务接口private Class s…

DNS A记录和CNAME记录

参考文章&#xff1a;http://blog.xieyc.com/differences-between-a-record-and-cname-record/ A (Address) 记录是用来指定主机名&#xff08;或域名&#xff09;对应的IP地址记录。用户可以将该域名下的网站服务器指向到自己的web server上。同时也可以设置您域名的二级域名。…

远程调用,限制请求超时时间处理

HttpClient处理 HttpClient httpClientpost new DefaultHttpClient(); String Posturl"xxx"; HttpPost httpPost new HttpPost(Posturl); RequestConfig ReqConfig RequestConfig.custom().setConnectTimeout(1000) //连接超时时间.setConnectionRequestTimeout…

HttpSession 和 HttpSession

说cookie机制采用的是在客户端保持状态的方案&#xff0c;而session机制采用的是在服务器端保持状态的方案。转载于:https://www.cnblogs.com/YangBinChina/p/8970673.html

flask 坑

no python application found, check your startup logs for errors 日志里面报类似于“Mon Mar 23 10:26:49 2015 – — no python application found, check your startup logs for errors —”这类错误时&#xff0c;需要好好检查一下xml文件 这个文件里面行尾不能有空格&am…

js数组sort排序原理

大家都知道javascript的数组有sort排序方法,可以实现升序与降序&#xff0c;现在我们来学习一下sort方法排序的原理冒泡排序。冒泡排序:拿数组的当前项和后一项比较&#xff0c;如果当前项大于后一项&#xff0c;两者交换位置。 1 let arr [100, 34, 16, 3, 18, 70];2 3 for …

多数据源处理-苞米豆-dynamic

微服务项目虽然每个服务可以单独使用一个库&#xff0c;但是某些特定服务&#xff0c;如调度中心服务&#xff0c;定时任务等&#xff0c;如果还是使用rpc或者fegin频繁进行远程调用&#xff0c;总感觉不是很合适 所以对单服务进行了多数据源处理 使用的是苞米豆的 dynamic-d…

springboot版本升级导致webservice调用失败org.apache.cxf.common.jaxb.JAXBUtils.createMininumEscapeHandle

很感谢这位作者的文章https://blog.csdn.net/q340505050518/article/details/105394315 近期对项目版本进行升级 原项目版本 从 Springcloud alibaba 2.1.0 Spring cloud Greenwich SpringBoot 2.1.3版本升级&#xff0c; 一开始升级的版本是&#xff1a; Springclo…