You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.2 KiB
45 lines
1.2 KiB
package {{ package.Common }}.config;
|
|
|
|
import io.swagger.v3.oas.models.OpenAPI;
|
|
import io.swagger.v3.oas.models.info.Contact;
|
|
import io.swagger.v3.oas.models.info.Info;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
/**
|
|
* Swagger3 / OpenAPI 配置
|
|
*
|
|
* @Author: snail
|
|
* @Date: 2026-02-06
|
|
* @Wechat: ot_bus
|
|
*
|
|
* 访问地址:
|
|
* http://localhost:port/swagger-ui/index.html
|
|
*/
|
|
@Configuration
|
|
public class SwaggerConfig {
|
|
|
|
@Value("${swagger.show:true}")
|
|
private boolean swaggerShow;
|
|
|
|
@Bean
|
|
public OpenAPI openAPI() {
|
|
if (!swaggerShow) {
|
|
// 生产环境关闭文档
|
|
return new OpenAPI();
|
|
}
|
|
|
|
return new OpenAPI()
|
|
.info(new Info()
|
|
.title("数据中心接口文档")
|
|
.description("数据中心相关接口文档")
|
|
.version("1.0")
|
|
.contact(new Contact()
|
|
.name("snail")
|
|
.url("https://www.deepseek.com/")
|
|
.email("")
|
|
)
|
|
);
|
|
}
|
|
}
|
|
|