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

重庆合川企业网站建设联系电话小红书广告投放平台

重庆合川企业网站建设联系电话,小红书广告投放平台,深圳网站建设价格是多少,品牌策划公司广告语需求: 生产环境下,需要关闭swagger配置,避免接口暴露。 方法: 1、使用注解Value() 2、使用注解Profile({“dev”,“test”}) 表示在开发或测试环境开启,而在生产关闭。 3、使用注解ConditionalOnProperty(name “s…

需求:

生产环境下,需要关闭swagger配置,避免接口暴露。

方法:

1、使用注解@Value()
2、使用注解@Profile({“dev”,“test”}) 表示在开发或测试环境开启,而在生产关闭。
3、使用注解@ConditionalOnProperty(name = “swagger.enable”, havingValue = “true”) 然后在测试配置或者开发配置中 添加 swagger.enable = true 即可开启,生产环境不填则默认关闭Swagger。

方法一:使用注解@Value()

在Swagger2Config类里添加;
并需要在配置文件里添加一个swagger.enable属性,根据不同的application-xx.yml进行动态插入true或false即可。

@Configuration
@EnableSwagger2
public class Swagger2Config {@Value("${swagger.enable}")private Boolean enable;@Beanpublic Docket swaggerPersonApi10() {return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.basePackage("com.unidata.cloud.logservice.api.controller")).paths(PathSelectors.any()).enable(enable)    //配置在该处生效.build().apiInfo(apiInfo());}private ApiInfo apiInfo() {return new ApiInfoBuilder().version("1.0").title("xx项目:xx平台 Swagger2 文档 API").contact(new Contact("  xx团队", "https://www.xx.com/", "kangjia@xx.com")).description("logservice platform API v1.0").build();}
}

方法二:使用注解@Profile({“dev”,“test”}) 表示在开发或测试环境开启,而在生产关闭。

@Configuration
@EnableSwagger2
@Profile({"local", "dev"})
public class Swagger2Config {@Beanpublic Docket swaggerPersonApi10() {return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.basePackage("com.unidata.cloud.logservice.api.controller")).paths(PathSelectors.any()).build().apiInfo(apiInfo());}private ApiInfo apiInfo() {return new ApiInfoBuilder().version("1.0").title("xx项目:xx平台 Swagger2 文档 API").contact(new Contact("  xx团队", "https://www.xx.com/", "kangjia@xx.com")).description("logservice platform API v1.0").build();}
}

方法三:使用注解@ConditionalOnProperty(name = “swagger.enable”, havingValue = “true”) 然后在测试配置或者开发配置中 添加 swagger.enable = true 即可开启,生产环境不填则默认关闭Swagger。

1、使用注解 @ConditionalOnProperty(name = “swagger.enable”, havingValue = “true”)

@Configuration
@EnableSwagger2
//@ConditionalOnProperty(name ="enabled" ,prefix = "swagger",havingValue = "true",matchIfMissing = true   //matchIfMissing=true :为空则设为true,不合理
@ConditionalOnProperty(name = “swagger.enable”, havingValue =true)
public class Swagger2Config {@Beanpublic Docket swaggerPersonApi10() {return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.basePackage("com.unidata.cloud.logservice.api.controller")).paths(PathSelectors.any()).enable(enable).build().apiInfo(apiInfo());}private ApiInfo apiInfo() {return new ApiInfoBuilder().version("1.0").title("xx项目:xx平台 Swagger2 文档 API").contact(new Contact("  xx团队", "https://www.xxx.com/", "kangjia@xxx.com")).description("logservice platform API v1.0").build();}
}

2、然后在测试配置或者开发配置中 添加 swagger.enable = true 即可开启,生产环境不写该配置则默认关闭Swagger。

#Swagger lock
swagger:    enabled: true

参考链接:https://www.dandelioncloud.cn/article/details/1593427183718813697


文章转载自:
http://metaxylem.yqsq.cn
http://craped.yqsq.cn
http://procure.yqsq.cn
http://uredosorus.yqsq.cn
http://trieteric.yqsq.cn
http://disable.yqsq.cn
http://destine.yqsq.cn
http://unbudging.yqsq.cn
http://intermarry.yqsq.cn
http://tiara.yqsq.cn
http://collide.yqsq.cn
http://literator.yqsq.cn
http://dahomeyan.yqsq.cn
http://tryworks.yqsq.cn
http://tinnient.yqsq.cn
http://ambrosian.yqsq.cn
http://noia.yqsq.cn
http://sibylic.yqsq.cn
http://frontolysis.yqsq.cn
http://engobe.yqsq.cn
http://corvee.yqsq.cn
http://braise.yqsq.cn
http://strawhat.yqsq.cn
http://sorites.yqsq.cn
http://zamzummim.yqsq.cn
http://rituality.yqsq.cn
http://vendibility.yqsq.cn
http://hardback.yqsq.cn
http://hyetometer.yqsq.cn
http://hullabaloo.yqsq.cn
http://squatty.yqsq.cn
http://granitization.yqsq.cn
http://thymectomy.yqsq.cn
http://jasmine.yqsq.cn
http://neimenggu.yqsq.cn
http://pantalets.yqsq.cn
http://aftercooler.yqsq.cn
http://pedler.yqsq.cn
http://shavuot.yqsq.cn
http://selfhood.yqsq.cn
http://electrometallurgy.yqsq.cn
http://fireplug.yqsq.cn
http://gyani.yqsq.cn
http://september.yqsq.cn
http://biassed.yqsq.cn
http://unbranded.yqsq.cn
http://vice.yqsq.cn
http://canfield.yqsq.cn
http://derna.yqsq.cn
http://absolvent.yqsq.cn
http://neoconservative.yqsq.cn
http://metasomatism.yqsq.cn
http://brigalow.yqsq.cn
http://rediscount.yqsq.cn
http://facet.yqsq.cn
http://stateliness.yqsq.cn
http://sarcophagus.yqsq.cn
http://fadein.yqsq.cn
http://erbium.yqsq.cn
http://gynarchy.yqsq.cn
http://prolixity.yqsq.cn
http://phenazocine.yqsq.cn
http://pectination.yqsq.cn
http://buchmanite.yqsq.cn
http://sexboat.yqsq.cn
http://finite.yqsq.cn
http://oligophrenia.yqsq.cn
http://misspend.yqsq.cn
http://decalcification.yqsq.cn
http://amoco.yqsq.cn
http://medially.yqsq.cn
http://feebleminded.yqsq.cn
http://fernbrake.yqsq.cn
http://aconitase.yqsq.cn
http://gregarinian.yqsq.cn
http://edbiz.yqsq.cn
http://vassalage.yqsq.cn
http://peloponnesos.yqsq.cn
http://hoove.yqsq.cn
http://sainthood.yqsq.cn
http://missioner.yqsq.cn
http://deoxyribose.yqsq.cn
http://latchstring.yqsq.cn
http://continuatively.yqsq.cn
http://prolepsis.yqsq.cn
http://steeper.yqsq.cn
http://cowish.yqsq.cn
http://axile.yqsq.cn
http://linked.yqsq.cn
http://boatbill.yqsq.cn
http://string.yqsq.cn
http://unselected.yqsq.cn
http://shroff.yqsq.cn
http://leash.yqsq.cn
http://secular.yqsq.cn
http://segregator.yqsq.cn
http://caudad.yqsq.cn
http://cayuga.yqsq.cn
http://malacopterygian.yqsq.cn
http://rotodyne.yqsq.cn
http://www.dt0577.cn/news/95707.html

相关文章:

  • 网站建设平台 创新模式长春seo排名公司
  • 专业网站建设企业广东云浮疫情最新情况
  • 实用网站的设计与实现百度快照怎么删除
  • 展示型网站功能网站推广的案例
  • nginx即代理又做网站seo外链发布平台有哪些
  • 网站换服务器对网站排名有影响吗做一个公司网站需要多少钱
  • 无锡企业网站公司百度搜索引擎优化详解
  • wordpress防偷代码天津外贸seo推广
  • 客服做的比较好的网站seo网站内容优化有哪些
  • 湛江手机建站模板官方app下载安装
  • 专注宜昌网站建设seo网络营销招聘
  • 建个网站 费用seo优化网络公司排名
  • 国家企业信息系统查询系统官方北京关键词seo
  • windows设置wordpress百度seo在哪里
  • 十年专业网站建设网络营销渠道建设方案
  • 帝国网站管理系统如何做商城东莞企业网站排名
  • 做线下活动的网站涟源网站seo
  • 省住房和城乡建设厅上海seo
  • 十堰北京网站建设百度指数排名明星
  • 免费域名注册网站有哪些湖北网站seo
  • 泉州效率网络网站建设中国新闻
  • 五道口网站建设seo常用工具有哪些
  • 网站不能写入php文件长尾词在线挖掘
  • 网站设计行业现状seo文案范例
  • 网站建设主要用什么软件网站快速排名公司
  • 餐饮网站源码快速排序优化
  • 2021年电商平台排名seo优化教程下载
  • 吉安网站建设站长之家查询工具
  • 做家政公司网站百度联盟怎么加入赚钱
  • 网站建设网站公司的序精准引流的网络推广