Unverified Commit 295146ef authored by ZackYoung's avatar ZackYoung Committed by GitHub

[build] [update version] update_version & add_actuator (#2024)

* update_version & add_actuator * update_version & add_actuator * update_version & add_actuator * update_version & add_actuator * update_version & add_actuator * update_version & add_actuator
parent 2172a194
...@@ -62,13 +62,7 @@ ...@@ -62,13 +62,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.xiaoymin</groupId> <groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId> <artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
...@@ -151,6 +145,10 @@ ...@@ -151,6 +145,10 @@
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId> <artifactId>sa-token-spring-boot-starter</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- sa-token 持久化 --> <!-- sa-token 持久化 -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
...@@ -302,6 +300,10 @@ ...@@ -302,6 +300,10 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -41,7 +41,6 @@ import cn.dev33.satoken.interceptor.SaInterceptor; ...@@ -41,7 +41,6 @@ import cn.dev33.satoken.interceptor.SaInterceptor;
*/ */
@Configuration @Configuration
public class AppConfig implements WebMvcConfigurer { public class AppConfig implements WebMvcConfigurer {
/** /**
* Cookie * Cookie
* *
...@@ -76,6 +75,7 @@ public class AppConfig implements WebMvcConfigurer { ...@@ -76,6 +75,7 @@ public class AppConfig implements WebMvcConfigurer {
registry.addInterceptor(new SaInterceptor()) registry.addInterceptor(new SaInterceptor())
.addPathPatterns("/api/**") .addPathPatterns("/api/**")
.excludePathPatterns("/api/login") .excludePathPatterns("/api/login")
.excludePathPatterns("/druid/**")
.excludePathPatterns("/openapi/**"); .excludePathPatterns("/openapi/**");
registry.addInterceptor(new TenantInterceptor()) registry.addInterceptor(new TenantInterceptor())
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
package org.dinky.configure; package org.dinky.configure;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.cache.RedisCacheConfiguration;
...@@ -32,6 +33,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; ...@@ -32,6 +33,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
* @since 2022/09/24 11:23 * @since 2022/09/24 11:23
*/ */
@Configuration @Configuration
@ConditionalOnProperty(prefix = "spring.cache", name = "type", havingValue = "REDIS")
public class CacheConfig { public class CacheConfig {
/** 配置Redis缓存注解的value序列化方式 */ /** 配置Redis缓存注解的value序列化方式 */
......
...@@ -19,27 +19,47 @@ ...@@ -19,27 +19,47 @@
package org.dinky.configure; package org.dinky.configure;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.autoconfigure.endpoint.web.CorsEndpointProperties;
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementPortType;
import org.springframework.boot.actuate.endpoint.ExposableEndpoint;
import org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver;
import org.springframework.boot.actuate.endpoint.web.EndpointMapping;
import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;
import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo; import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration @Configuration
@EnableSwagger2
public class Knife4jConfig { public class Knife4jConfig {
@Value("${dinky.version}")
private String dinkyVersion;
@Bean(value = "defaultApi2") @Bean(value = "defaultApi2")
public Docket defaultApi2() { public Docket defaultApi2() {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo()) .apiInfo(apiInfo())
.groupName("V1.0") .groupName(dinkyVersion)
.select() .select()
.apis(RequestHandlerSelectors.basePackage("org.dinky.controller")) .apis(RequestHandlerSelectors.basePackage("org.dinky.controller"))
.paths(PathSelectors.any()) .paths(PathSelectors.any())
...@@ -50,7 +70,46 @@ public class Knife4jConfig { ...@@ -50,7 +70,46 @@ public class Knife4jConfig {
return new ApiInfoBuilder() return new ApiInfoBuilder()
.title("Dinky REST APIS") .title("Dinky REST APIS")
.description("Dinky REST APIS") .description("Dinky REST APIS")
.version("1.0") .version(dinkyVersion)
.licenseUrl("https://www.apache.org/licenses/LICENSE-2.0")
.license("Apache 2.0")
.contact(new Contact("Dinky 开源", "http://www.dlink.top/", ""))
.build(); .build();
} }
/** 增加如下配置可解决Spring Boot 6.x 与Swagger 3.0.0 不兼容问题 */
@Bean
public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(
WebEndpointsSupplier webEndpointsSupplier,
ServletEndpointsSupplier servletEndpointsSupplier,
ControllerEndpointsSupplier controllerEndpointsSupplier,
EndpointMediaTypes endpointMediaTypes,
CorsEndpointProperties corsProperties,
WebEndpointProperties webEndpointProperties,
Environment environment) {
List<ExposableEndpoint<?>> allEndpoints = new ArrayList();
Collection<ExposableWebEndpoint> webEndpoints = webEndpointsSupplier.getEndpoints();
allEndpoints.addAll(webEndpoints);
allEndpoints.addAll(servletEndpointsSupplier.getEndpoints());
allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints());
String basePath = webEndpointProperties.getBasePath();
EndpointMapping endpointMapping = new EndpointMapping(basePath);
boolean shouldRegisterLinksMapping =
this.shouldRegisterLinksMapping(webEndpointProperties, environment, basePath);
return new WebMvcEndpointHandlerMapping(
endpointMapping,
webEndpoints,
endpointMediaTypes,
corsProperties.toCorsConfiguration(),
new EndpointLinksResolver(allEndpoints, basePath),
shouldRegisterLinksMapping,
null);
}
private boolean shouldRegisterLinksMapping(
WebEndpointProperties webEndpointProperties, Environment environment, String basePath) {
return webEndpointProperties.getDiscovery().isEnabled()
&& (StringUtils.hasText(basePath)
|| ManagementPortType.get(environment)
.equals(ManagementPortType.DIFFERENT));
}
} }
...@@ -55,6 +55,7 @@ public class SysConfig extends Model<SysConfig> { ...@@ -55,6 +55,7 @@ public class SysConfig extends Model<SysConfig> {
groups = {Save.class}) groups = {Save.class})
private String name; private String name;
@TableField(value = "`value`")
private String value; private String value;
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
......
...@@ -48,11 +48,14 @@ public class EnvInit implements ApplicationRunner { ...@@ -48,11 +48,14 @@ public class EnvInit implements ApplicationRunner {
+ "Local: \t\thttp://localhost:{}\n\t" + "Local: \t\thttp://localhost:{}\n\t"
+ "External: \thttp://{}:{}\n\t" + "External: \thttp://{}:{}\n\t"
+ "Doc: \thttp://{}:{}/doc.html\n" + "Doc: \thttp://{}:{}/doc.html\n"
+ "Druid Monitor: \thttp://{}:{}/druid/index.html\n"
+ "----------------------------------------------------------", + "----------------------------------------------------------",
port, port,
ipAddress, ipAddress,
port, port,
ipAddress, ipAddress,
port,
ipAddress,
port); port);
} }
} }
...@@ -78,8 +78,7 @@ public class SysConfigServiceImpl extends SuperServiceImpl<SysConfigMapper, SysC ...@@ -78,8 +78,7 @@ public class SysConfigServiceImpl extends SuperServiceImpl<SysConfigMapper, SysC
}) })
.forEach(Model::insertOrUpdate); .forEach(Model::insertOrUpdate);
Map<String, String> configMap = Map<String, String> configMap =
CollUtil.toMap( CollUtil.toMap(list(), new HashMap<>(), SysConfig::getName, SysConfig::getValue);
sysConfigList, new HashMap<>(), SysConfig::getName, SysConfig::getValue);
systemConfiguration.setConfiguration(configMap); systemConfiguration.setConfiguration(configMap);
} }
......
...@@ -56,6 +56,7 @@ public class MavenUtil { ...@@ -56,6 +56,7 @@ public class MavenUtil {
.getParentFile(), .getParentFile(),
"/bin/java") "/bin/java")
.getAbsolutePath(); .getAbsolutePath();
private static final String EXECTOR = SystemUtil.getOsInfo().isWindows() ? "mvn.cmd" : "mvn";
// /home/zackyoung/.jdks/corretto-1.8.0_372/bin/java // /home/zackyoung/.jdks/corretto-1.8.0_372/bin/java
// -Dmaven.multiModuleProjectDirectory=/home/zackyoung/IdeaProjects/dinky-quickstart-java // -Dmaven.multiModuleProjectDirectory=/home/zackyoung/IdeaProjects/dinky-quickstart-java
...@@ -151,7 +152,7 @@ public class MavenUtil { ...@@ -151,7 +152,7 @@ public class MavenUtil {
} }
public static String getMavenVersion() { public static String getMavenVersion() {
return RuntimeUtil.execForStr(getMavenHome() + "/bin/mvn -v"); return RuntimeUtil.execForStr(getMavenHome() + "/bin/" + EXECTOR + " -v");
} }
public static String getMavenHome() { public static String getMavenHome() {
...@@ -160,7 +161,7 @@ public class MavenUtil { ...@@ -160,7 +161,7 @@ public class MavenUtil {
return mavenHome; return mavenHome;
} }
String searchCmd = SystemUtil.getOsInfo().isWindows() ? "where" : "which"; String searchCmd = SystemUtil.getOsInfo().isWindows() ? "where" : "which";
mavenHome = RuntimeUtil.execForStr(searchCmd + " mvn").trim(); mavenHome = RuntimeUtil.execForStr(searchCmd + " " + EXECTOR).trim();
if (StrUtil.isNotBlank(mavenHome)) { if (StrUtil.isNotBlank(mavenHome)) {
try { try {
return new File(mavenHome).toPath().toRealPath().getParent().getParent().toString(); return new File(mavenHome).toPath().toRealPath().getParent().getParent().toString();
......
...@@ -54,6 +54,7 @@ spring.datasource.druid.stat-view-servlet.url-pattern=/druid/* ...@@ -54,6 +54,7 @@ spring.datasource.druid.stat-view-servlet.url-pattern=/druid/*
spring.datasource.druid.stat-view-servlet.reset-enable=true spring.datasource.druid.stat-view-servlet.reset-enable=true
spring.datasource.druid.stat-view-servlet.login-username=admin spring.datasource.druid.stat-view-servlet.login-username=admin
spring.datasource.druid.stat-view-servlet.login-password=admin spring.datasource.druid.stat-view-servlet.login-password=admin
spring.datasource.druid.stat-view-servlet.allow=
##### mybatis-plus配置 ##### mybatis-plus配置
......
...@@ -15,7 +15,7 @@ spring: ...@@ -15,7 +15,7 @@ spring:
# If you use pgsql database, please configure pgsql database connection information in application-pgsql.yml # If you use pgsql database, please configure pgsql database connection information in application-pgsql.yml
# If you use the h2 database, please configure the h2 database connection information in application-h2.yml, # If you use the h2 database, please configure the h2 database connection information in application-h2.yml,
# note: the h2 database is only for experience use, and the related data that has been created cannot be migrated, please use it with caution # note: the h2 database is only for experience use, and the related data that has been created cannot be migrated, please use it with caution
active: mysql #[h2,mysql,pgsql] active: h2 #[h2,mysql,pgsql]
# mvc config # mvc config
mvc: mvc:
...@@ -148,21 +148,27 @@ sa-token: ...@@ -148,21 +148,27 @@ sa-token:
################################################################################################################# #################################################################################################################
knife4j: knife4j:
enable: true enable: true
# openapi:
################################################################################################################## # title: Dinky REST APIS
################################################## DolphinScheduler Config ####################################### # description: Dinky REST APIS
################################################################################################################## # concat: Dinky
#dinky: # url: http://www.dlink.top/
# dolphinscheduler: # version: v4.0
# # If you enable the integrated DolphinScheduler, you need to configure the following configuration items # license: Apache 2.0
# enabled: false # license-url: https://www.apache.org/licenses/LICENSE-2.0
# # DolphinScheduler Address # group:
# # Note: The address must be the same as the address configured in the DolphinScheduler background , eg: http://127.0.0.1:12345/dolphinscheduler # Api:
# url: http://127.0.0.1:5173/dolphinscheduler # group-name: Dinky Api
# # DolphinScheduler's Token , Please create a token in DolphinScheduler's Security Center -> Token Management, and modify the following configuration # api-rule: package
# token: ad54eb8f57fadea95f52763517978b26 # api-rule-resources:
# # The project name specified in DolphinScheduler, case insensitive # - org.dinky.controller
# project-name: Dinky Dinky:
# # DolphinScheduler DinkyTask Address , eg: http://127.0.0.1:8888 version: @project.version@
# # note: the address must be the same as the address configured in the Dinky Application background url
# address: http://127.0.0.1:8888 management:
health:
redis:
enabled: false
sms:
is-print: false
\ No newline at end of file
...@@ -39,7 +39,10 @@ ...@@ -39,7 +39,10 @@
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
</dependency>
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
...@@ -49,10 +52,6 @@ ...@@ -49,10 +52,6 @@
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky-common</artifactId> <artifactId>dinky-common</artifactId>
...@@ -108,5 +107,9 @@ ...@@ -108,5 +107,9 @@
<artifactId>junit-jupiter</artifactId> <artifactId>junit-jupiter</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -148,10 +148,8 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => { ...@@ -148,10 +148,8 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
setPercent(parseInt(String(100 / stepNum * currentStep))); setPercent(parseInt(String(100 / stepNum * currentStep)));
stepArray[currentStep - 1].status = renderStatus(status) stepArray[currentStep - 1].status = renderStatus(status)
} }
if ((status === 2 || status === 0) && currentStep === stepNum) { if ((status === 2 && currentStep === stepNum) || status === 0) {
if (currentStep === stepNum) { stepArray.forEach(d => d.disabled = false)
stepArray.forEach(d => d.disabled = false)
}
finish = true; finish = true;
eventSource.close(); eventSource.close();
return; return;
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<jaxb.version>2.3.0</jaxb.version> <jaxb.version>2.3.0</jaxb.version>
<jedis.version>2.9.0</jedis.version> <jedis.version>2.9.0</jedis.version>
<junit5.version>5.9.1</junit5.version> <junit5.version>5.9.1</junit5.version>
<knife4j.version>3.0.3</knife4j.version> <knife4j.version>4.1.0</knife4j.version>
<log4j.version>2.19.0</log4j.version> <log4j.version>2.19.0</log4j.version>
<lombok.version>1.18.24</lombok.version> <lombok.version>1.18.24</lombok.version>
<maven-assembly-plugin.version>3.4.2</maven-assembly-plugin.version> <maven-assembly-plugin.version>3.4.2</maven-assembly-plugin.version>
...@@ -107,13 +107,20 @@ ...@@ -107,13 +107,20 @@
<snakeyaml.version>1.33</snakeyaml.version> <snakeyaml.version>1.33</snakeyaml.version>
<spotless.ratchetFrom>origin/dev</spotless.ratchetFrom> <spotless.ratchetFrom>origin/dev</spotless.ratchetFrom>
<spotless.version>2.27.1</spotless.version> <spotless.version>2.27.1</spotless.version>
<spring-boot-dependencies.version>2.6.13</spring-boot-dependencies.version> <spring-boot-dependencies.version>2.7.11</spring-boot-dependencies.version>
<target.java.version>8</target.java.version> <target.java.version>8</target.java.version>
<testcontainers.version>1.16.2</testcontainers.version> <testcontainers.version>1.16.2</testcontainers.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-dependencies</artifactId>
<version>${knife4j.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency> <dependency>
<groupId>org.junit</groupId> <groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId> <artifactId>junit-bom</artifactId>
...@@ -248,11 +255,6 @@ ...@@ -248,11 +255,6 @@
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment