mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-08 16:57:09 +08:00
refactor(core): ProjectProperties => ApplicationProperties
This commit is contained in:
@@ -47,7 +47,7 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import top.continew.starter.apidoc.handler.BaseEnumParameterHandler;
|
||||
import top.continew.starter.apidoc.handler.OpenApiHandler;
|
||||
import top.continew.starter.core.autoconfigure.project.ProjectProperties;
|
||||
import top.continew.starter.core.autoconfigure.application.ApplicationProperties;
|
||||
import top.continew.starter.core.util.GeneralPropertySourceFactory;
|
||||
|
||||
import java.util.List;
|
||||
@@ -83,15 +83,15 @@ public class SpringDocAutoConfiguration implements WebMvcConfigurer {
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public OpenAPI openApi(ProjectProperties projectProperties, SpringDocExtensionProperties properties) {
|
||||
Info info = new Info().title("%s %s".formatted(projectProperties.getName(), "API 文档"))
|
||||
.version(projectProperties.getVersion())
|
||||
.description(projectProperties.getDescription());
|
||||
ProjectProperties.Contact contact = projectProperties.getContact();
|
||||
public OpenAPI openApi(ApplicationProperties applicationProperties, SpringDocExtensionProperties properties) {
|
||||
Info info = new Info().title("%s %s".formatted(applicationProperties.getName(), "API 文档"))
|
||||
.version(applicationProperties.getVersion())
|
||||
.description(applicationProperties.getDescription());
|
||||
ApplicationProperties.Contact contact = applicationProperties.getContact();
|
||||
if (contact != null) {
|
||||
info.contact(new Contact().name(contact.getName()).email(contact.getEmail()).url(contact.getUrl()));
|
||||
}
|
||||
ProjectProperties.License license = projectProperties.getLicense();
|
||||
ApplicationProperties.License license = applicationProperties.getLicense();
|
||||
if (license != null) {
|
||||
info.license(new License().name(license.getName()).url(license.getUrl()));
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.starter.core.autoconfigure.project;
|
||||
package top.continew.starter.core.autoconfigure.application;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
@@ -22,7 +22,7 @@ import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* 项目自动配置
|
||||
* 应用自动配置
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 1.0.0
|
||||
@@ -30,5 +30,5 @@ import org.springframework.context.annotation.Import;
|
||||
@AutoConfiguration
|
||||
@ComponentScan("cn.hutool.extra.spring")
|
||||
@Import(cn.hutool.extra.spring.SpringUtil.class)
|
||||
@EnableConfigurationProperties(ProjectProperties.class)
|
||||
public class ProjectAutoConfiguration {}
|
||||
@EnableConfigurationProperties(ApplicationProperties.class)
|
||||
public class ApplicationAutoConfiguration {}
|
@@ -14,18 +14,23 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.starter.core.autoconfigure.project;
|
||||
package top.continew.starter.core.autoconfigure.application;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* 项目配置属性
|
||||
* 应用配置属性
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@ConfigurationProperties("project")
|
||||
public class ProjectProperties {
|
||||
@ConfigurationProperties("application")
|
||||
public class ApplicationProperties {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
@@ -33,20 +38,15 @@ public class ProjectProperties {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 应用名称
|
||||
* 描述
|
||||
*/
|
||||
private String appName;
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* URL
|
||||
*/
|
||||
@@ -147,6 +147,14 @@ public class ProjectProperties {
|
||||
}
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -155,12 +163,12 @@ public class ProjectProperties {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAppName() {
|
||||
return appName;
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setAppName(String appName) {
|
||||
this.appName = appName;
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
@@ -171,14 +179,6 @@ public class ProjectProperties {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
@@ -1,3 +1,3 @@
|
||||
top.continew.starter.core.autoconfigure.project.ProjectAutoConfiguration
|
||||
top.continew.starter.core.autoconfigure.application.ApplicationAutoConfiguration
|
||||
top.continew.starter.core.autoconfigure.threadpool.ThreadPoolAutoConfiguration
|
||||
top.continew.starter.core.autoconfigure.threadpool.AsyncAutoConfiguration
|
Reference in New Issue
Block a user