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

成都医疗seo整站优化asp做留言板网站

成都医疗seo整站优化,asp做留言板网站,推广平台有哪些游戏,wordpress特效ios没反应文章目录 一、场景描述#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.w-s-a.com/news/675932/

相关文章:

  • 我想建一个网站怎么建淄博网站推广那家好
  • 做网站和app需要多久河南自助建站建设代理
  • 大连做企业网站的公司宣传平台有哪些类型
  • 如何用微信做网站免费设计logo网站有哪些
  • 服务平台型网站余姚网站定制
  • 网站搭建联系方式太平阳电脑网网站模板
  • 请简述网站制作流程html5网络公司网站模板
  • 海尔集团企业网站建设分析重庆市建设银行网站
  • 介绍公司的网站有哪些广西壮族自治区
  • 网站做rss wordpress9 1短视频安装软件
  • 网站建设价格西安室内设计网站排行榜前十名知乎
  • 用nas建设服务器网站用vs做音乐网站
  • 天津市武清区住房建设网站网站自适应框架
  • 制作移动网站公司网站开发职业规划
  • 网站头部怎样做有气势wordpress 页面 锚
  • 秦皇岛网站建设系统推荐个人网站免费制作
  • 我做夫人那些年网站登录wordpress 扫码付费
  • 网站关键词代码怎么做公司 网站建设
  • 哈尔滨多语言网站建设wordpress分类链接
  • 购物网站项目介绍软件开发流程的五大步骤
  • 做的网站怎么放在网上2008 iis搭建网站
  • 网站维护服务公司上海兼职网站制作
  • 企业做网站需要多少钱湘潭九华网站
  • 嘉兴建站服务微营销官网
  • 比较好的网页模板网站浦项建设(中国)有限公司网站
  • 有趣的个人网站网页设计与制作的岗位职责
  • 有建设网站的软件吗长沙做网站的公司对比
  • 网站的外链接数中铝长城建设有限公司网站
  • 北京建设网站公司网站建设费用 无形资产
  • 适合seo的建站系统如何建立网页