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 @@
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</exclusion>
</exclusions>
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
......@@ -151,6 +145,10 @@
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- sa-token 持久化 -->
<dependency>
<groupId>org.springframework.boot</groupId>
......@@ -302,6 +300,10 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -41,7 +41,6 @@ import cn.dev33.satoken.interceptor.SaInterceptor;
*/
@Configuration
public class AppConfig implements WebMvcConfigurer {
/**
* Cookie
*
......@@ -76,6 +75,7 @@ public class AppConfig implements WebMvcConfigurer {
registry.addInterceptor(new SaInterceptor())
.addPathPatterns("/api/**")
.excludePathPatterns("/api/login")
.excludePathPatterns("/druid/**")
.excludePathPatterns("/openapi/**");
registry.addInterceptor(new TenantInterceptor())
......
......@@ -19,6 +19,7 @@
package org.dinky.configure;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
......@@ -32,6 +33,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
* @since 2022/09/24 11:23
*/
@Configuration
@ConditionalOnProperty(prefix = "spring.cache", name = "type", havingValue = "REDIS")
public class CacheConfig {
/** 配置Redis缓存注解的value序列化方式 */
......
......@@ -19,27 +19,47 @@
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.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class Knife4jConfig {
@Value("${dinky.version}")
private String dinkyVersion;
@Bean(value = "defaultApi2")
public Docket defaultApi2() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.groupName("V1.0")
.groupName(dinkyVersion)
.select()
.apis(RequestHandlerSelectors.basePackage("org.dinky.controller"))
.paths(PathSelectors.any())
......@@ -50,7 +70,46 @@ public class Knife4jConfig {
return new ApiInfoBuilder()
.title("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();
}
/** 增加如下配置可解决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> {
groups = {Save.class})
private String name;
@TableField(value = "`value`")
private String value;
@TableField(fill = FieldFill.INSERT)
......
......@@ -48,11 +48,14 @@ public class EnvInit implements ApplicationRunner {
+ "Local: \t\thttp://localhost:{}\n\t"
+ "External: \thttp://{}:{}\n\t"
+ "Doc: \thttp://{}:{}/doc.html\n"
+ "Druid Monitor: \thttp://{}:{}/druid/index.html\n"
+ "----------------------------------------------------------",
port,
ipAddress,
port,
ipAddress,
port,
ipAddress,
port);
}
}
......@@ -78,8 +78,7 @@ public class SysConfigServiceImpl extends SuperServiceImpl<SysConfigMapper, SysC
})
.forEach(Model::insertOrUpdate);
Map<String, String> configMap =
CollUtil.toMap(
sysConfigList, new HashMap<>(), SysConfig::getName, SysConfig::getValue);
CollUtil.toMap(list(), new HashMap<>(), SysConfig::getName, SysConfig::getValue);
systemConfiguration.setConfiguration(configMap);
}
......
......@@ -56,6 +56,7 @@ public class MavenUtil {
.getParentFile(),
"/bin/java")
.getAbsolutePath();
private static final String EXECTOR = SystemUtil.getOsInfo().isWindows() ? "mvn.cmd" : "mvn";
// /home/zackyoung/.jdks/corretto-1.8.0_372/bin/java
// -Dmaven.multiModuleProjectDirectory=/home/zackyoung/IdeaProjects/dinky-quickstart-java
......@@ -151,7 +152,7 @@ public class MavenUtil {
}
public static String getMavenVersion() {
return RuntimeUtil.execForStr(getMavenHome() + "/bin/mvn -v");
return RuntimeUtil.execForStr(getMavenHome() + "/bin/" + EXECTOR + " -v");
}
public static String getMavenHome() {
......@@ -160,7 +161,7 @@ public class MavenUtil {
return mavenHome;
}
String searchCmd = SystemUtil.getOsInfo().isWindows() ? "where" : "which";
mavenHome = RuntimeUtil.execForStr(searchCmd + " mvn").trim();
mavenHome = RuntimeUtil.execForStr(searchCmd + " " + EXECTOR).trim();
if (StrUtil.isNotBlank(mavenHome)) {
try {
return new File(mavenHome).toPath().toRealPath().getParent().getParent().toString();
......
......@@ -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.login-username=admin
spring.datasource.druid.stat-view-servlet.login-password=admin
spring.datasource.druid.stat-view-servlet.allow=
##### mybatis-plus配置
......
......@@ -15,7 +15,7 @@ spring:
# 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,
# 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:
......@@ -148,21 +148,27 @@ sa-token:
#################################################################################################################
knife4j:
enable: true
##################################################################################################################
################################################## DolphinScheduler Config #######################################
##################################################################################################################
#dinky:
# dolphinscheduler:
# # If you enable the integrated DolphinScheduler, you need to configure the following configuration items
# enabled: false
# # DolphinScheduler Address
# # Note: The address must be the same as the address configured in the DolphinScheduler background , eg: http://127.0.0.1:12345/dolphinscheduler
# url: http://127.0.0.1:5173/dolphinscheduler
# # DolphinScheduler's Token , Please create a token in DolphinScheduler's Security Center -> Token Management, and modify the following configuration
# token: ad54eb8f57fadea95f52763517978b26
# # The project name specified in DolphinScheduler, case insensitive
# project-name: Dinky
# # DolphinScheduler DinkyTask Address , eg: http://127.0.0.1:8888
# # note: the address must be the same as the address configured in the Dinky Application background url
# address: http://127.0.0.1:8888
# openapi:
# title: Dinky REST APIS
# description: Dinky REST APIS
# concat: Dinky
# url: http://www.dlink.top/
# version: v4.0
# license: Apache 2.0
# license-url: https://www.apache.org/licenses/LICENSE-2.0
# group:
# Api:
# group-name: Dinky Api
# api-rule: package
# api-rule-resources:
# - org.dinky.controller
Dinky:
version: @project.version@
management:
health:
redis:
enabled: false
sms:
is-print: false
\ No newline at end of file
......@@ -39,7 +39,10 @@
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
......@@ -49,10 +52,6 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.dinky</groupId>
<artifactId>dinky-common</artifactId>
......@@ -108,5 +107,9 @@
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
</dependencies>
</project>
......@@ -148,10 +148,8 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
setPercent(parseInt(String(100 / stepNum * currentStep)));
stepArray[currentStep - 1].status = renderStatus(status)
}
if ((status === 2 || status === 0) && currentStep === stepNum) {
if (currentStep === stepNum) {
stepArray.forEach(d => d.disabled = false)
}
if ((status === 2 && currentStep === stepNum) || status === 0) {
stepArray.forEach(d => d.disabled = false)
finish = true;
eventSource.close();
return;
......
......@@ -72,7 +72,7 @@
<jaxb.version>2.3.0</jaxb.version>
<jedis.version>2.9.0</jedis.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>
<lombok.version>1.18.24</lombok.version>
<maven-assembly-plugin.version>3.4.2</maven-assembly-plugin.version>
......@@ -107,13 +107,20 @@
<snakeyaml.version>1.33</snakeyaml.version>
<spotless.ratchetFrom>origin/dev</spotless.ratchetFrom>
<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>
<testcontainers.version>1.16.2</testcontainers.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-dependencies</artifactId>
<version>${knife4j.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
......@@ -248,11 +255,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<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