refactor: 优化部分代码

1.修复 Sonar 扫描问题
2.使用常量替代部分魔法值
This commit is contained in:
2024-01-27 23:10:27 +08:00
parent ef0e99de83
commit 75fe5377df
9 changed files with 102 additions and 61 deletions

View File

@@ -38,6 +38,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import top.charles7c.continew.starter.core.autoconfigure.project.ProjectProperties;
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
import top.charles7c.continew.starter.core.util.GeneralPropertySourceFactory;
import java.util.List;
@@ -53,7 +54,7 @@ import java.util.concurrent.TimeUnit;
@Slf4j
@EnableWebMvc
@AutoConfiguration
@ConditionalOnProperty(name = "springdoc.swagger-ui.enabled", havingValue = "true")
@ConditionalOnProperty(prefix = PropertiesConstants.SPRINGDOC_SWAGGER_UI, name = PropertiesConstants.ENABLED, havingValue = "true")
@EnableConfigurationProperties(SpringDocExtensionProperties.class)
@PropertySource(value = "classpath:default-api-doc.yml", factory = GeneralPropertySourceFactory.class)
public class SpringDocAutoConfiguration implements WebMvcConfigurer {

View File

@@ -20,6 +20,7 @@ import io.swagger.v3.oas.models.Components;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
/**
* API 文档扩展配置属性
@@ -28,7 +29,7 @@ import org.springframework.boot.context.properties.NestedConfigurationProperty;
* @since 1.0.1
*/
@Data
@ConfigurationProperties(prefix = "springdoc")
@ConfigurationProperties(prefix = PropertiesConstants.SPRINGDOC)
public class SpringDocExtensionProperties {
/**