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