Spring Boot 禁用 Swagger
在生產(chǎn)環(huán)境下,我們需要關(guān)閉swagger配置,避免暴露接口的這種危險行為。
使用@Profile({“dev”,“test”})?注解,表示在開發(fā)或測試環(huán)境開啟,而在生產(chǎn)關(guān)閉

2.設(shè)置環(huán)境,SpringBoot默認(rèn)環(huán)境為default,如果沒有明確地指定Profile,通常表示生產(chǎn)環(huán)境,dev表示開發(fā)環(huán)境

標(biāo)簽: