当前位置: 首页 > news >正文

怎么做网站内部搜索功能公司网站的开发

怎么做网站内部搜索功能,公司网站的开发,梁露 网站建设与实践,公众号怎么开通文章目录 一、场景描述#xff1a;swagger导出文件名称乱码二、乱码原因三、解决方法3.1、方法一、在浏览器中输入地址下载3.2、方法二、swagger升级为2.10.0及以上 四、可能遇到的问题4.1、DocumentationPluginsManager.java:152 一、场景描述#xff1a;swagger导出文件名称… 文章目录 一、场景描述swagger导出文件名称乱码二、乱码原因三、解决方法3.1、方法一、在浏览器中输入地址下载3.2、方法二、swagger升级为2.10.0及以上 四、可能遇到的问题4.1、DocumentationPluginsManager.java:152 一、场景描述swagger导出文件名称乱码 场景描述springboot项目集成swagger2.9.2后下载文件时若文件名有中文则乱码。 1依赖如下 !--swagger2-- dependencygroupIdio.springfox/groupIdartifactIdspringfox-swagger2/artifactIdversion2.9.2/version /dependency dependencygroupIdio.springfox/groupIdartifactIdspringfox-swagger-ui/artifactIdversion2.9.2/version /dependency2下载文件乱码如下 3java代码如下 Controller RequestMapping(/file) public class FileController {GetMapping(/export1)public void printSubmit1( HttpServletResponse response) throws Exception {//获取模板位置InputStream templateFileName getClass().getResourceAsStream(/template/dataSourceDetailExport.xlsx);String fileName 测试文件;ListListString dataList new ArrayList();for(int i0;i3;i){ListString data new ArrayList();for(int j1;j10;j){data.add(ij);}dataList.add(data);}try {//对文件名进行编码防止中文乱码fileName URLEncoder.encode(fileName, UTF-8);response.setContentType(application/vnd.ms-excel);response.setCharacterEncoding(utf8);response.setHeader(Content-Disposition, attachment; filename fileName .xlsx);response.setHeader(Pragma, public);response.setHeader(Cache-Control, no-store);response.addHeader(Cache-Control, max-age0);OutputStream os response.getOutputStream();EasyExcel.write(os).withTemplate(templateFileName).sheet().doWrite(dataList);;} catch (IOException e) {throw new Exception(导出excel表格失败!, e);}} }二、乱码原因 这是由于sweagger2.9.2版本问题导致的在swagger2.9.2中下载是乱码的但是直接在浏览器中输入请求下载就是正常的。 三、解决方法 3.1、方法一、在浏览器中输入地址下载 3.2、方法二、swagger升级为2.10.0及以上 需要将swagger升级为2.10.0及以上 重点需要swagger包含的spring-plugin-core包是2.0.0.RELEASE版本swagger包含的spring-plugin-metadata包是2.0.0.RELEASE版本 1依赖如下 !--swagger2-- dependencygroupIdio.springfox/groupIdartifactIdspringfox-spring-webmvc/artifactIdversion2.10.0/version /dependency dependencygroupIdio.springfox/groupIdartifactIdspringfox-swagger2/artifactIdversion2.10.0/version /dependency dependencygroupIdio.springfox/groupIdartifactIdspringfox-swagger-ui/artifactIdversion2.10.0/version /dependency2swagger配置如下 package com.demo.config;import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;import java.text.SimpleDateFormat; import java.util.Date;Configuration EnableSwagger2WebMvc public class SwaggerConfig {Beanpublic Docket createRestApi() {return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.basePackage(com.demo)) //你自己的package.paths(PathSelectors.any()).build();}public ApiInfo apiInfo() {return new ApiInfoBuilder().title(小工具\tnew SimpleDateFormat(yyyy-MM-dd).format(new Date())).description(docker-compose).version(1.0).termsOfServiceUrl().build();} }3下载结果如下图 四、可能遇到的问题 4.1、DocumentationPluginsManager.java:152 Description:An attempt was made to call a method that does not exist. The attempt was made from the following location:springfox.documentation.spring.web.plugins.DocumentationPluginsManager.createContextBuilder(DocumentationPluginsManager.java:152)The following method did not exist:org.springframework.plugin.core.PluginRegistry.getPluginFor(Ljava/lang/Object;Lorg/springframework/plugin/core/Plugin;)Lorg/springframework/plugin/core/Plugin;The methods class, org.springframework.plugin.core.PluginRegistry, is available from the following locations:jar:file:/D:/maven/MavenRepository/org/springframework/plugin/spring-plugin-core/2.0.0.RELEASE/spring-plugin-core-2.0.0.RELEASE.jar!/org/springframework/plugin/core/PluginRegistry.classThe class hierarchy was loaded from the following locations:org.springframework.plugin.core.PluginRegistry: file:/D:/maven/MavenRepository/org/springframework/plugin/spring-plugin-core/2.0.0.RELEASE/spring-plugin-core-2.0.0.RELEASE.jarAction:Correct the classpath of your application so that it contains a single, compatible version of org.springframework.plugin.core.PluginRegistry若遇到以上问题则先在swagger中排除以下依赖并手动引入以下版本的依赖 dependencyartifactIdspring-plugin-core/artifactIdgroupIdorg.springframework.plugin/groupIdversion2.0.0.RELEASE/version /dependency dependencyartifactIdspring-plugin-metadata/artifactIdgroupIdorg.springframework.plugin/groupIdversion2.0.0.RELEASE/version /dependency注意 spring-plugin-core-2.0.0.RELEASE版本需要与swagger2.10.0及以上版本配合使用。若swagger版本为2.9.2及以下需要用低版本的spring-plugin-core-1.2.0.RELEASE版本
http://www.hkea.cn/news/14555571/

相关文章:

  • php招聘网站建设昭通建网站
  • 网站不显示域名解析错误怎么办邮箱如何注册企业邮箱
  • 如何在百度做自己公司的网站p2p网站建设框架
  • 建设部网站规范查询营销云产品
  • 合肥高新区建设发展局网站通河县机场建设网站
  • 淘宝客代理网站怎么做wordpress分享后查看
  • wordpress商城插件收费采集站seo赚钱辅导班
  • 烟台小学网站建设徐州商城网站建设
  • 顺义网站制作安徽安庆
  • 网站建设合同付款方式济南做网站公司
  • 上海企业网站建设价格电子购物网站
  • 网站建设方案书简单常用的平面设计软件有哪些
  • 网站制作的前期主要是做好什么工作优化大师的三大功能
  • 网站开发面试问题营销网站四大要素
  • wordpress子目录 多站点淘宝客怎么自己做网站
  • 广告网站做动图怎么做河南省建设厅电话号码是多少
  • 1免费建站网站做网站在什么地方发帖子呢
  • 免费网站建设模版云盘网页编辑表格
  • 企业网站建设哪家便宜请seo的人帮做网站排名
  • 关键词查询网站济宁网站建设制作设计
  • 河北廊坊seo网站建设网站优化wordpress改端口
  • 辽宁建设局网站首页网站建设技术分析
  • 一般网站自己可以做播放器吗wordpress主题放在哪个文件夹
  • 创建网站得花多少钱电子商务网站建设原则
  • golang建设网站东莞网站优化软件
  • 深圳网站建设公司服务商网站的管理与维护
  • 杭州优化网站广州移动网站开发
  • dw外部网站链接怎么做net做网站
  • 电子商务网站开发要学什么哪里有服务好的网站建设
  • 许昌住房和城乡建设局网站中卫网站推广软件