refactor: 封装公共配置,降低使用复杂度

This commit is contained in:
2023-11-25 20:45:16 +08:00
parent 4a8e4e4408
commit dafb2d8f5b
9 changed files with 123 additions and 0 deletions

View File

@@ -26,7 +26,10 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import top.charles7c.continew.starter.core.autoconfigure.ProjectProperties;
import top.charles7c.continew.starter.core.handler.GeneralPropertySourceFactory;
/**
* API 文档自动配置
@@ -37,6 +40,7 @@ import top.charles7c.continew.starter.core.autoconfigure.ProjectProperties;
@Slf4j
@AutoConfiguration
@ConditionalOnProperty(name = "springdoc.swagger-ui.enabled", havingValue = "true")
@PropertySource(value = "classpath:default-api-doc.yml", factory = GeneralPropertySourceFactory.class)
public class SpringDocAutoConfiguration {
/**

View File

@@ -0,0 +1,16 @@
--- ### 接口文档配置
springdoc:
swagger-ui:
path: /swagger-ui.html
tags-sorter: alpha
operations-sorter: alpha
show-extensions: true
api-docs:
enabled: ${springdoc.swagger-ui.enabled}
path: /v3/api-docs
## 接口文档增强配置
knife4j:
enable: true
setting:
language: zh_cn
swagger-model-name: 实体类列表