Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
c5e24b2ffe
1
pom.xml
1
pom.xml
|
@ -331,7 +331,6 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module>ruoyi-admin</module>
|
<module>ruoyi-admin</module>
|
||||||
<module>ruoyi-common</module>
|
<module>ruoyi-common</module>
|
||||||
<module>ruoyi-extend</module>
|
|
||||||
<module>ruoyi-modules</module>
|
<module>ruoyi-modules</module>
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
|
@ -22,32 +22,6 @@
|
||||||
<groupId>com.mysql</groupId>
|
<groupId>com.mysql</groupId>
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Oracle -->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>com.oracle.database.jdbc</groupId>-->
|
|
||||||
<!-- <artifactId>ojdbc8</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<!-- PostgreSql -->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.postgresql</groupId>-->
|
|
||||||
<!-- <artifactId>postgresql</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<!-- SqlServer -->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>com.microsoft.sqlserver</groupId>-->
|
|
||||||
<!-- <artifactId>mssql-jdbc</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.dromara</groupId>-->
|
|
||||||
<!-- <artifactId>ruoyi-common-doc</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.dromara</groupId>-->
|
|
||||||
<!-- <artifactId>ruoyi-common-social</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
<artifactId>ruoyi-common-mail</artifactId>
|
<artifactId>ruoyi-common-mail</artifactId>
|
||||||
|
@ -63,24 +37,12 @@
|
||||||
<artifactId>ruoyi-system</artifactId>
|
<artifactId>ruoyi-system</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.dromara</groupId>-->
|
|
||||||
<!-- <artifactId>ruoyi-job</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 代码生成-->
|
<!-- 代码生成-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
<artifactId>ruoyi-generator</artifactId>
|
<artifactId>ruoyi-generator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- demo模块 -->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.dromara</groupId>-->
|
|
||||||
<!-- <artifactId>ruoyi-demo</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
<artifactId>rouyi-scale</artifactId>
|
<artifactId>rouyi-scale</artifactId>
|
||||||
|
|
|
@ -1,29 +1,3 @@
|
||||||
--- # 监控中心配置
|
|
||||||
spring.boot.admin.client:
|
|
||||||
# 增加客户端开关
|
|
||||||
enabled: true
|
|
||||||
url: http://localhost:9090/admin
|
|
||||||
instance:
|
|
||||||
service-host-type: IP
|
|
||||||
username: ruoyi
|
|
||||||
password: 123456
|
|
||||||
|
|
||||||
--- # powerjob 配置
|
|
||||||
powerjob:
|
|
||||||
worker:
|
|
||||||
# 如何开启调度中心请查看文档教程
|
|
||||||
enabled: false
|
|
||||||
# 需要先在 powerjob 登录页执行应用注册后才能使用
|
|
||||||
app-name: ruoyi-worker
|
|
||||||
allow-lazy-connect-server: false
|
|
||||||
max-appended-wf-context-length: 4096
|
|
||||||
max-result-length: 4096
|
|
||||||
# 28080 端口 随着主应用端口飘逸 避免集群冲突
|
|
||||||
port: 2${server.port}
|
|
||||||
protocol: http
|
|
||||||
server-address: 127.0.0.1:7700
|
|
||||||
store-strategy: disk
|
|
||||||
|
|
||||||
--- # 数据源配置
|
--- # 数据源配置
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
|
|
|
@ -1,32 +1,6 @@
|
||||||
--- # 临时文件存储位置 避免临时文件被系统清理报错
|
--- # 临时文件存储位置 避免临时文件被系统清理报错
|
||||||
spring.servlet.multipart.location: /ruoyi/server/temp
|
spring.servlet.multipart.location: /ruoyi/server/temp
|
||||||
|
|
||||||
--- # 监控中心配置
|
|
||||||
spring.boot.admin.client:
|
|
||||||
# 增加客户端开关
|
|
||||||
enabled: true
|
|
||||||
url: http://localhost:9090/admin
|
|
||||||
instance:
|
|
||||||
service-host-type: IP
|
|
||||||
username: ruoyi
|
|
||||||
password: 123456
|
|
||||||
|
|
||||||
--- # powerjob 配置
|
|
||||||
powerjob:
|
|
||||||
worker:
|
|
||||||
# 如何开启调度中心请查看文档教程
|
|
||||||
enabled: false
|
|
||||||
# 需要先在 powerjob 登录页执行应用注册后才能使用
|
|
||||||
app-name: ruoyi-worker
|
|
||||||
allow-lazy-connect-server: false
|
|
||||||
max-appended-wf-context-length: 4096
|
|
||||||
max-result-length: 4096
|
|
||||||
# 28080 端口 随着主应用端口飘逸 避免集群冲突
|
|
||||||
port: 2${server.port}
|
|
||||||
protocol: http
|
|
||||||
server-address: 127.0.0.1:7700
|
|
||||||
store-strategy: disk
|
|
||||||
|
|
||||||
--- # 数据源配置
|
--- # 数据源配置
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
|
|
|
@ -1,29 +1,3 @@
|
||||||
--- # 监控中心配置
|
|
||||||
spring.boot.admin.client:
|
|
||||||
# 增加客户端开关
|
|
||||||
enabled: true
|
|
||||||
url: http://localhost:9090/admin
|
|
||||||
instance:
|
|
||||||
service-host-type: IP
|
|
||||||
username: ruoyi
|
|
||||||
password: 123456
|
|
||||||
|
|
||||||
--- # powerjob 配置
|
|
||||||
powerjob:
|
|
||||||
worker:
|
|
||||||
# 如何开启调度中心请查看文档教程
|
|
||||||
enabled: false
|
|
||||||
# 需要先在 powerjob 登录页执行应用注册后才能使用
|
|
||||||
app-name: ruoyi-worker
|
|
||||||
allow-lazy-connect-server: false
|
|
||||||
max-appended-wf-context-length: 4096
|
|
||||||
max-result-length: 4096
|
|
||||||
# 28080 端口 随着主应用端口飘逸 避免集群冲突
|
|
||||||
port: 2${server.port}
|
|
||||||
protocol: http
|
|
||||||
server-address: 127.0.0.1:7700
|
|
||||||
store-strategy: disk
|
|
||||||
|
|
||||||
--- # 数据源配置
|
--- # 数据源配置
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module>ruoyi-common-bom</module>
|
<module>ruoyi-common-bom</module>
|
||||||
<module>ruoyi-common-core</module>
|
<module>ruoyi-common-core</module>
|
||||||
<module>ruoyi-common-doc</module>
|
|
||||||
<module>ruoyi-common-excel</module>
|
<module>ruoyi-common-excel</module>
|
||||||
<module>ruoyi-common-idempotent</module>
|
<module>ruoyi-common-idempotent</module>
|
||||||
<module>ruoyi-common-log</module>
|
<module>ruoyi-common-log</module>
|
||||||
|
|
|
@ -26,13 +26,6 @@
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 接口模块 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-common-doc</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- excel -->
|
<!-- excel -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
|
@ -47,13 +40,6 @@
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 调度模块 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-common-job</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 日志记录 -->
|
<!-- 日志记录 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
|
@ -117,12 +103,6 @@
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-common-social</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- web服务 -->
|
<!-- web服务 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
|
@ -158,13 +138,6 @@
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 租户模块 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-common-tenant</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- WebSocket模块 -->
|
<!-- WebSocket模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-common</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>ruoyi-common-doc</artifactId>
|
|
||||||
|
|
||||||
<description>
|
|
||||||
ruoyi-common-doc 系统接口
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-common-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springdoc</groupId>
|
|
||||||
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.therapi</groupId>
|
|
||||||
<artifactId>therapi-runtime-javadoc</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.module</groupId>
|
|
||||||
<artifactId>jackson-module-kotlin</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,126 +0,0 @@
|
||||||
package org.dromara.common.doc.config;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.models.OpenAPI;
|
|
||||||
import io.swagger.v3.oas.models.Paths;
|
|
||||||
import io.swagger.v3.oas.models.info.Info;
|
|
||||||
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
|
||||||
import org.dromara.common.doc.config.properties.SpringDocProperties;
|
|
||||||
import org.dromara.common.doc.handler.OpenApiHandler;
|
|
||||||
import org.springdoc.core.configuration.SpringDocConfiguration;
|
|
||||||
import org.springdoc.core.customizers.OpenApiBuilderCustomizer;
|
|
||||||
import org.springdoc.core.customizers.OpenApiCustomizer;
|
|
||||||
import org.springdoc.core.customizers.ServerBaseUrlCustomizer;
|
|
||||||
import org.springdoc.core.properties.SpringDocConfigProperties;
|
|
||||||
import org.springdoc.core.providers.JavadocProvider;
|
|
||||||
import org.springdoc.core.service.OpenAPIService;
|
|
||||||
import org.springdoc.core.service.SecurityService;
|
|
||||||
import org.springdoc.core.utils.PropertyResolverUtils;
|
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Swagger 文档配置
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@AutoConfiguration(before = SpringDocConfiguration.class)
|
|
||||||
@EnableConfigurationProperties(SpringDocProperties.class)
|
|
||||||
@ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true", matchIfMissing = true)
|
|
||||||
public class SpringDocConfig {
|
|
||||||
|
|
||||||
private final ServerProperties serverProperties;
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnMissingBean(OpenAPI.class)
|
|
||||||
public OpenAPI openApi(SpringDocProperties properties) {
|
|
||||||
OpenAPI openApi = new OpenAPI();
|
|
||||||
// 文档基本信息
|
|
||||||
SpringDocProperties.InfoProperties infoProperties = properties.getInfo();
|
|
||||||
Info info = convertInfo(infoProperties);
|
|
||||||
openApi.info(info);
|
|
||||||
// 扩展文档信息
|
|
||||||
openApi.externalDocs(properties.getExternalDocs());
|
|
||||||
openApi.tags(properties.getTags());
|
|
||||||
openApi.paths(properties.getPaths());
|
|
||||||
openApi.components(properties.getComponents());
|
|
||||||
Set<String> keySet = properties.getComponents().getSecuritySchemes().keySet();
|
|
||||||
List<SecurityRequirement> list = new ArrayList<>();
|
|
||||||
SecurityRequirement securityRequirement = new SecurityRequirement();
|
|
||||||
keySet.forEach(securityRequirement::addList);
|
|
||||||
list.add(securityRequirement);
|
|
||||||
openApi.security(list);
|
|
||||||
|
|
||||||
return openApi;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Info convertInfo(SpringDocProperties.InfoProperties infoProperties) {
|
|
||||||
Info info = new Info();
|
|
||||||
info.setTitle(infoProperties.getTitle());
|
|
||||||
info.setDescription(infoProperties.getDescription());
|
|
||||||
info.setContact(infoProperties.getContact());
|
|
||||||
info.setLicense(infoProperties.getLicense());
|
|
||||||
info.setVersion(infoProperties.getVersion());
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自定义 openapi 处理器
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public OpenAPIService openApiBuilder(Optional<OpenAPI> openAPI,
|
|
||||||
SecurityService securityParser,
|
|
||||||
SpringDocConfigProperties springDocConfigProperties, PropertyResolverUtils propertyResolverUtils,
|
|
||||||
Optional<List<OpenApiBuilderCustomizer>> openApiBuilderCustomisers,
|
|
||||||
Optional<List<ServerBaseUrlCustomizer>> serverBaseUrlCustomisers, Optional<JavadocProvider> javadocProvider) {
|
|
||||||
return new OpenApiHandler(openAPI, securityParser, springDocConfigProperties, propertyResolverUtils, openApiBuilderCustomisers, serverBaseUrlCustomisers, javadocProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 对已经生成好的 OpenApi 进行自定义操作
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public OpenApiCustomizer openApiCustomizer() {
|
|
||||||
String contextPath = serverProperties.getServlet().getContextPath();
|
|
||||||
String finalContextPath;
|
|
||||||
if (StringUtils.isBlank(contextPath) || "/".equals(contextPath)) {
|
|
||||||
finalContextPath = "";
|
|
||||||
} else {
|
|
||||||
finalContextPath = contextPath;
|
|
||||||
}
|
|
||||||
// 对所有路径增加前置上下文路径
|
|
||||||
return openApi -> {
|
|
||||||
Paths oldPaths = openApi.getPaths();
|
|
||||||
if (oldPaths instanceof PlusPaths) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
PlusPaths newPaths = new PlusPaths();
|
|
||||||
oldPaths.forEach((k, v) -> newPaths.addPathItem(finalContextPath + k, v));
|
|
||||||
openApi.setPaths(newPaths);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单独使用一个类便于判断 解决springdoc路径拼接重复问题
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
static class PlusPaths extends Paths {
|
|
||||||
|
|
||||||
public PlusPaths() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,94 +0,0 @@
|
||||||
package org.dromara.common.doc.config.properties;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.models.Components;
|
|
||||||
import io.swagger.v3.oas.models.ExternalDocumentation;
|
|
||||||
import io.swagger.v3.oas.models.Paths;
|
|
||||||
import io.swagger.v3.oas.models.info.Contact;
|
|
||||||
import io.swagger.v3.oas.models.info.License;
|
|
||||||
import io.swagger.v3.oas.models.tags.Tag;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* swagger 配置属性
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ConfigurationProperties(prefix = "springdoc")
|
|
||||||
public class SpringDocProperties {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文档基本信息
|
|
||||||
*/
|
|
||||||
@NestedConfigurationProperty
|
|
||||||
private InfoProperties info = new InfoProperties();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 扩展文档地址
|
|
||||||
*/
|
|
||||||
@NestedConfigurationProperty
|
|
||||||
private ExternalDocumentation externalDocs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标签
|
|
||||||
*/
|
|
||||||
private List<Tag> tags = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 路径
|
|
||||||
*/
|
|
||||||
@NestedConfigurationProperty
|
|
||||||
private Paths paths = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 组件
|
|
||||||
*/
|
|
||||||
@NestedConfigurationProperty
|
|
||||||
private Components components = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 文档的基础属性信息
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @see io.swagger.v3.oas.models.info.Info
|
|
||||||
*
|
|
||||||
* 为了 springboot 自动生产配置提示信息,所以这里复制一个类出来
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public static class InfoProperties {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标题
|
|
||||||
*/
|
|
||||||
private String title = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 描述
|
|
||||||
*/
|
|
||||||
private String description = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 联系人信息
|
|
||||||
*/
|
|
||||||
@NestedConfigurationProperty
|
|
||||||
private Contact contact = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 许可证
|
|
||||||
*/
|
|
||||||
@NestedConfigurationProperty
|
|
||||||
private License license = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 版本
|
|
||||||
*/
|
|
||||||
private String version = null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,252 +0,0 @@
|
||||||
package org.dromara.common.doc.handler;
|
|
||||||
|
|
||||||
import cn.hutool.core.io.IoUtil;
|
|
||||||
import io.swagger.v3.core.jackson.TypeNameResolver;
|
|
||||||
import io.swagger.v3.core.util.AnnotationsUtils;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tags;
|
|
||||||
import io.swagger.v3.oas.models.Components;
|
|
||||||
import io.swagger.v3.oas.models.OpenAPI;
|
|
||||||
import io.swagger.v3.oas.models.Operation;
|
|
||||||
import io.swagger.v3.oas.models.Paths;
|
|
||||||
import io.swagger.v3.oas.models.tags.Tag;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springdoc.core.customizers.OpenApiBuilderCustomizer;
|
|
||||||
import org.springdoc.core.customizers.ServerBaseUrlCustomizer;
|
|
||||||
import org.springdoc.core.properties.SpringDocConfigProperties;
|
|
||||||
import org.springdoc.core.providers.JavadocProvider;
|
|
||||||
import org.springdoc.core.service.OpenAPIService;
|
|
||||||
import org.springdoc.core.service.SecurityService;
|
|
||||||
import org.springdoc.core.utils.PropertyResolverUtils;
|
|
||||||
import org.springframework.context.ApplicationContext;
|
|
||||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
import org.springframework.web.method.HandlerMethod;
|
|
||||||
|
|
||||||
import java.io.StringReader;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自定义 openapi 处理器
|
|
||||||
* 对源码功能进行修改 增强使用
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@SuppressWarnings("all")
|
|
||||||
public class OpenApiHandler extends OpenAPIService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Basic error controller.
|
|
||||||
*/
|
|
||||||
private static Class<?> basicErrorController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Security parser.
|
|
||||||
*/
|
|
||||||
private final SecurityService securityParser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Mappings map.
|
|
||||||
*/
|
|
||||||
private final Map<String, Object> mappingsMap = new HashMap<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Springdoc tags.
|
|
||||||
*/
|
|
||||||
private final Map<HandlerMethod, Tag> springdocTags = new HashMap<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Open api builder customisers.
|
|
||||||
*/
|
|
||||||
private final Optional<List<OpenApiBuilderCustomizer>> openApiBuilderCustomisers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The server base URL customisers.
|
|
||||||
*/
|
|
||||||
private final Optional<List<ServerBaseUrlCustomizer>> serverBaseUrlCustomizers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Spring doc config properties.
|
|
||||||
*/
|
|
||||||
private final SpringDocConfigProperties springDocConfigProperties;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Cached open api map.
|
|
||||||
*/
|
|
||||||
private final Map<String, OpenAPI> cachedOpenAPI = new HashMap<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Property resolver utils.
|
|
||||||
*/
|
|
||||||
private final PropertyResolverUtils propertyResolverUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The javadoc provider.
|
|
||||||
*/
|
|
||||||
private final Optional<JavadocProvider> javadocProvider;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Context.
|
|
||||||
*/
|
|
||||||
private ApplicationContext context;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Open api.
|
|
||||||
*/
|
|
||||||
private OpenAPI openAPI;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Is servers present.
|
|
||||||
*/
|
|
||||||
private boolean isServersPresent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Server base url.
|
|
||||||
*/
|
|
||||||
private String serverBaseUrl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new Open api builder.
|
|
||||||
*
|
|
||||||
* @param openAPI the open api
|
|
||||||
* @param securityParser the security parser
|
|
||||||
* @param springDocConfigProperties the spring doc config properties
|
|
||||||
* @param propertyResolverUtils the property resolver utils
|
|
||||||
* @param openApiBuilderCustomizers the open api builder customisers
|
|
||||||
* @param serverBaseUrlCustomizers the server base url customizers
|
|
||||||
* @param javadocProvider the javadoc provider
|
|
||||||
*/
|
|
||||||
public OpenApiHandler(Optional<OpenAPI> openAPI, SecurityService securityParser,
|
|
||||||
SpringDocConfigProperties springDocConfigProperties, PropertyResolverUtils propertyResolverUtils,
|
|
||||||
Optional<List<OpenApiBuilderCustomizer>> openApiBuilderCustomizers,
|
|
||||||
Optional<List<ServerBaseUrlCustomizer>> serverBaseUrlCustomizers,
|
|
||||||
Optional<JavadocProvider> javadocProvider) {
|
|
||||||
super(openAPI, securityParser, springDocConfigProperties, propertyResolverUtils, openApiBuilderCustomizers, serverBaseUrlCustomizers, javadocProvider);
|
|
||||||
if (openAPI.isPresent()) {
|
|
||||||
this.openAPI = openAPI.get();
|
|
||||||
if (this.openAPI.getComponents() == null)
|
|
||||||
this.openAPI.setComponents(new Components());
|
|
||||||
if (this.openAPI.getPaths() == null)
|
|
||||||
this.openAPI.setPaths(new Paths());
|
|
||||||
if (!CollectionUtils.isEmpty(this.openAPI.getServers()))
|
|
||||||
this.isServersPresent = true;
|
|
||||||
}
|
|
||||||
this.propertyResolverUtils = propertyResolverUtils;
|
|
||||||
this.securityParser = securityParser;
|
|
||||||
this.springDocConfigProperties = springDocConfigProperties;
|
|
||||||
this.openApiBuilderCustomisers = openApiBuilderCustomizers;
|
|
||||||
this.serverBaseUrlCustomizers = serverBaseUrlCustomizers;
|
|
||||||
this.javadocProvider = javadocProvider;
|
|
||||||
if (springDocConfigProperties.isUseFqn())
|
|
||||||
TypeNameResolver.std.setUseFqn(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Operation buildTags(HandlerMethod handlerMethod, Operation operation, OpenAPI openAPI, Locale locale) {
|
|
||||||
|
|
||||||
Set<Tag> tags = new HashSet<>();
|
|
||||||
Set<String> tagsStr = new HashSet<>();
|
|
||||||
|
|
||||||
buildTagsFromMethod(handlerMethod.getMethod(), tags, tagsStr, locale);
|
|
||||||
buildTagsFromClass(handlerMethod.getBeanType(), tags, tagsStr, locale);
|
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(tagsStr))
|
|
||||||
tagsStr = tagsStr.stream()
|
|
||||||
.map(str -> propertyResolverUtils.resolve(str, locale))
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
|
|
||||||
if (springdocTags.containsKey(handlerMethod)) {
|
|
||||||
io.swagger.v3.oas.models.tags.Tag tag = springdocTags.get(handlerMethod);
|
|
||||||
tagsStr.add(tag.getName());
|
|
||||||
if (openAPI.getTags() == null || !openAPI.getTags().contains(tag)) {
|
|
||||||
openAPI.addTagsItem(tag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(tagsStr)) {
|
|
||||||
if (CollectionUtils.isEmpty(operation.getTags()))
|
|
||||||
operation.setTags(new ArrayList<>(tagsStr));
|
|
||||||
else {
|
|
||||||
Set<String> operationTagsSet = new HashSet<>(operation.getTags());
|
|
||||||
operationTagsSet.addAll(tagsStr);
|
|
||||||
operation.getTags().clear();
|
|
||||||
operation.getTags().addAll(operationTagsSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAutoTagClasses(operation)) {
|
|
||||||
|
|
||||||
|
|
||||||
if (javadocProvider.isPresent()) {
|
|
||||||
String description = javadocProvider.get().getClassJavadoc(handlerMethod.getBeanType());
|
|
||||||
if (StringUtils.isNotBlank(description)) {
|
|
||||||
io.swagger.v3.oas.models.tags.Tag tag = new io.swagger.v3.oas.models.tags.Tag();
|
|
||||||
|
|
||||||
// 自定义部分 修改使用java注释当tag名
|
|
||||||
List<String> list = IoUtil.readLines(new StringReader(description), new ArrayList<>());
|
|
||||||
// tag.setName(tagAutoName);
|
|
||||||
tag.setName(list.get(0));
|
|
||||||
operation.addTagsItem(list.get(0));
|
|
||||||
|
|
||||||
tag.setDescription(description);
|
|
||||||
if (openAPI.getTags() == null || !openAPI.getTags().contains(tag)) {
|
|
||||||
openAPI.addTagsItem(tag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
String tagAutoName = splitCamelCase(handlerMethod.getBeanType().getSimpleName());
|
|
||||||
operation.addTagsItem(tagAutoName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(tags)) {
|
|
||||||
// Existing tags
|
|
||||||
List<io.swagger.v3.oas.models.tags.Tag> openApiTags = openAPI.getTags();
|
|
||||||
if (!CollectionUtils.isEmpty(openApiTags))
|
|
||||||
tags.addAll(openApiTags);
|
|
||||||
openAPI.setTags(new ArrayList<>(tags));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle SecurityRequirement at operation level
|
|
||||||
io.swagger.v3.oas.annotations.security.SecurityRequirement[] securityRequirements = securityParser
|
|
||||||
.getSecurityRequirements(handlerMethod);
|
|
||||||
if (securityRequirements != null) {
|
|
||||||
if (securityRequirements.length == 0)
|
|
||||||
operation.setSecurity(Collections.emptyList());
|
|
||||||
else
|
|
||||||
securityParser.buildSecurityRequirement(securityRequirements, operation);
|
|
||||||
}
|
|
||||||
|
|
||||||
return operation;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buildTagsFromMethod(Method method, Set<io.swagger.v3.oas.models.tags.Tag> tags, Set<String> tagsStr, Locale locale) {
|
|
||||||
// method tags
|
|
||||||
Set<Tags> tagsSet = AnnotatedElementUtils
|
|
||||||
.findAllMergedAnnotations(method, Tags.class);
|
|
||||||
Set<io.swagger.v3.oas.annotations.tags.Tag> methodTags = tagsSet.stream()
|
|
||||||
.flatMap(x -> Stream.of(x.value())).collect(Collectors.toSet());
|
|
||||||
methodTags.addAll(AnnotatedElementUtils.findAllMergedAnnotations(method, io.swagger.v3.oas.annotations.tags.Tag.class));
|
|
||||||
if (!CollectionUtils.isEmpty(methodTags)) {
|
|
||||||
tagsStr.addAll(methodTags.stream().map(tag -> propertyResolverUtils.resolve(tag.name(), locale)).collect(Collectors.toSet()));
|
|
||||||
List<io.swagger.v3.oas.annotations.tags.Tag> allTags = new ArrayList<>(methodTags);
|
|
||||||
addTags(allTags, tags, locale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addTags(List<io.swagger.v3.oas.annotations.tags.Tag> sourceTags, Set<io.swagger.v3.oas.models.tags.Tag> tags, Locale locale) {
|
|
||||||
Optional<Set<io.swagger.v3.oas.models.tags.Tag>> optionalTagSet = AnnotationsUtils
|
|
||||||
.getTags(sourceTags.toArray(new io.swagger.v3.oas.annotations.tags.Tag[0]), true);
|
|
||||||
optionalTagSet.ifPresent(tagsSet -> {
|
|
||||||
tagsSet.forEach(tag -> {
|
|
||||||
tag.name(propertyResolverUtils.resolve(tag.getName(), locale));
|
|
||||||
tag.description(propertyResolverUtils.resolve(tag.getDescription(), locale));
|
|
||||||
if (tags.stream().noneMatch(t -> t.getName().equals(tag.getName())))
|
|
||||||
tags.add(tag);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
org.dromara.common.doc.config.SpringDocConfig
|
|
|
@ -1,18 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>ruoyi-vue-plus</artifactId>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<artifactId>ruoyi-extend</artifactId>
|
|
||||||
<packaging>pom</packaging>
|
|
||||||
|
|
||||||
<modules>
|
|
||||||
<module>ruoyi-monitor-admin</module>
|
|
||||||
</modules>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,17 +0,0 @@
|
||||||
#FROM findepi/graalvm:java17-native
|
|
||||||
FROM openjdk:17.0.2-oraclelinux8
|
|
||||||
|
|
||||||
MAINTAINER Lion Li
|
|
||||||
|
|
||||||
RUN mkdir -p /ruoyi/monitor/logs
|
|
||||||
|
|
||||||
WORKDIR /ruoyi/monitor
|
|
||||||
|
|
||||||
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
|
||||||
|
|
||||||
EXPOSE 9090
|
|
||||||
|
|
||||||
ADD ./target/ruoyi-monitor-admin.jar ./app.jar
|
|
||||||
|
|
||||||
ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -jar app.jar \
|
|
||||||
-XX:+HeapDumpOnOutOfMemoryError -Xlog:gc*,:time,tags,level -XX:+UseZGC ${JAVA_OPTS}
|
|
|
@ -1,65 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>ruoyi-extend</artifactId>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<artifactId>ruoyi-monitor-admin</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!-- SpringWeb模块 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- spring security 安全认证 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-security</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>de.codecentric</groupId>
|
|
||||||
<artifactId>spring-boot-admin-starter-server</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>de.codecentric</groupId>
|
|
||||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<finalName>${project.artifactId}</finalName>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
<version>${spring-boot.version}</version>
|
|
||||||
<configuration>
|
|
||||||
<!-- <fork>true</fork> <!– 如果没有该配置,devtools不会生效 –>-->
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>repackage</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,19 +0,0 @@
|
||||||
package org.dromara.monitor.admin;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Admin 监控启动程序
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
@SpringBootApplication
|
|
||||||
public class MonitorAdminApplication {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(MonitorAdminApplication.class, args);
|
|
||||||
System.out.println("Admin 监控启动成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
package org.dromara.monitor.admin.config;
|
|
||||||
|
|
||||||
import de.codecentric.boot.admin.server.config.EnableAdminServer;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
||||||
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
|
|
||||||
import org.springframework.boot.task.TaskExecutorBuilder;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* springboot-admin server配置类
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@EnableAdminServer
|
|
||||||
public class AdminServerConfig {
|
|
||||||
|
|
||||||
@Lazy
|
|
||||||
@Bean(name = TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME)
|
|
||||||
@ConditionalOnMissingBean(Executor.class)
|
|
||||||
public ThreadPoolTaskExecutor applicationTaskExecutor(TaskExecutorBuilder builder) {
|
|
||||||
return builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
package org.dromara.monitor.admin.config;
|
|
||||||
|
|
||||||
import de.codecentric.boot.admin.server.config.AdminServerProperties;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.security.config.Customizer;
|
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
||||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
|
||||||
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
|
||||||
import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
|
|
||||||
import org.springframework.security.web.SecurityFilterChain;
|
|
||||||
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
|
||||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* admin 监控 安全配置
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
@EnableWebSecurity
|
|
||||||
@Configuration
|
|
||||||
public class SecurityConfig {
|
|
||||||
|
|
||||||
private final String adminContextPath;
|
|
||||||
|
|
||||||
public SecurityConfig(AdminServerProperties adminServerProperties) {
|
|
||||||
this.adminContextPath = adminServerProperties.getContextPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
|
|
||||||
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
|
|
||||||
successHandler.setTargetUrlParameter("redirectTo");
|
|
||||||
successHandler.setDefaultTargetUrl(adminContextPath + "/");
|
|
||||||
|
|
||||||
return httpSecurity
|
|
||||||
.headers((header) ->
|
|
||||||
header.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable))
|
|
||||||
.authorizeHttpRequests((authorize) ->
|
|
||||||
authorize.requestMatchers(
|
|
||||||
new AntPathRequestMatcher(adminContextPath + "/assets/**"),
|
|
||||||
new AntPathRequestMatcher(adminContextPath + "/login"),
|
|
||||||
new AntPathRequestMatcher("/actuator"),
|
|
||||||
new AntPathRequestMatcher("/actuator/**")
|
|
||||||
).permitAll()
|
|
||||||
.anyRequest().authenticated())
|
|
||||||
.formLogin((formLogin) ->
|
|
||||||
formLogin.loginPage(adminContextPath + "/login").successHandler(successHandler))
|
|
||||||
.logout((logout) ->
|
|
||||||
logout.logoutUrl(adminContextPath + "/logout"))
|
|
||||||
.httpBasic(Customizer.withDefaults())
|
|
||||||
.csrf(AbstractHttpConfigurer::disable)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
package org.dromara.monitor.admin.notifier;
|
|
||||||
|
|
||||||
import de.codecentric.boot.admin.server.domain.entities.Instance;
|
|
||||||
import de.codecentric.boot.admin.server.domain.entities.InstanceRepository;
|
|
||||||
import de.codecentric.boot.admin.server.domain.events.InstanceEvent;
|
|
||||||
import de.codecentric.boot.admin.server.domain.events.InstanceStatusChangedEvent;
|
|
||||||
import de.codecentric.boot.admin.server.notify.AbstractEventNotifier;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import reactor.core.publisher.Mono;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自定义事件通知处理
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class CustomNotifier extends AbstractEventNotifier {
|
|
||||||
|
|
||||||
protected CustomNotifier(InstanceRepository repository) {
|
|
||||||
super(repository);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("all")
|
|
||||||
protected Mono<Void> doNotify(InstanceEvent event, Instance instance) {
|
|
||||||
return Mono.fromRunnable(() -> {
|
|
||||||
// 实例状态改变事件
|
|
||||||
if (event instanceof InstanceStatusChangedEvent) {
|
|
||||||
String registName = instance.getRegistration().getName();
|
|
||||||
String instanceId = event.getInstance().getValue();
|
|
||||||
String status = ((InstanceStatusChangedEvent) event).getStatusInfo().getStatus();
|
|
||||||
log.info("Instance Status Change: [{}],[{}],[{}]", registName, instanceId, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
server:
|
|
||||||
port: 9090
|
|
||||||
spring:
|
|
||||||
application:
|
|
||||||
name: ruoyi-monitor-admin
|
|
||||||
profiles:
|
|
||||||
active: @profiles.active@
|
|
||||||
|
|
||||||
logging:
|
|
||||||
config: classpath:logback-plus.xml
|
|
||||||
|
|
||||||
--- # 监控中心服务端配置
|
|
||||||
spring:
|
|
||||||
security:
|
|
||||||
user:
|
|
||||||
name: ruoyi
|
|
||||||
password: 123456
|
|
||||||
boot:
|
|
||||||
admin:
|
|
||||||
ui:
|
|
||||||
title: RuoYi-Vue-Plus服务监控中心
|
|
||||||
context-path: /admin
|
|
||||||
|
|
||||||
--- # Actuator 监控端点的配置项
|
|
||||||
management:
|
|
||||||
endpoints:
|
|
||||||
web:
|
|
||||||
exposure:
|
|
||||||
include: '*'
|
|
||||||
endpoint:
|
|
||||||
health:
|
|
||||||
show-details: ALWAYS
|
|
||||||
logfile:
|
|
||||||
external-file: ./logs/ruoyi-monitor-admin.log
|
|
||||||
|
|
||||||
--- # 监控配置
|
|
||||||
spring.boot.admin.client:
|
|
||||||
# 增加客户端开关
|
|
||||||
enabled: true
|
|
||||||
# 设置 Spring Boot Admin Server 地址
|
|
||||||
url: http://localhost:9090/admin
|
|
||||||
instance:
|
|
||||||
service-host-type: IP
|
|
||||||
username: ruoyi
|
|
||||||
password: 123456
|
|
|
@ -1,8 +0,0 @@
|
||||||
Application Version: ${revision}
|
|
||||||
Spring Boot Version: ${spring-boot.version}
|
|
||||||
__ __ _ _ _ _
|
|
||||||
| \/ | (_) | /\ | | (_)
|
|
||||||
| \ / | ___ _ __ _| |_ ___ _ __ ______ / \ __| |_ __ ___ _ _ __
|
|
||||||
| |\/| |/ _ \| '_ \| | __/ _ \| '__|______/ /\ \ / _` | '_ ` _ \| | '_ \
|
|
||||||
| | | | (_) | | | | | || (_) | | / ____ \ (_| | | | | | | | | | |
|
|
||||||
|_| |_|\___/|_| |_|_|\__\___/|_| /_/ \_\__,_|_| |_| |_|_|_| |_|
|
|
|
@ -1,34 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration debug="false" scan="true" scanPeriod="1 seconds">
|
|
||||||
|
|
||||||
<contextName>logback</contextName>
|
|
||||||
<property name="log.path" value="./logs/ruoyi-monitor-admin"/>
|
|
||||||
<property name="console.log.pattern"
|
|
||||||
value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/>
|
|
||||||
<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"/>
|
|
||||||
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${console.log.pattern}</pattern>
|
|
||||||
<charset>utf-8</charset>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.path}.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="console"/>
|
|
||||||
<appender-ref ref="file"/>
|
|
||||||
</root>
|
|
||||||
|
|
||||||
</configuration>
|
|
|
@ -27,21 +27,11 @@
|
||||||
<artifactId>ruoyi-system</artifactId>
|
<artifactId>ruoyi-system</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-common-doc</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
<artifactId>ruoyi-common-mybatis</artifactId>
|
<artifactId>ruoyi-common-mybatis</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-common-translation</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- OSS功能模块 -->
|
<!-- OSS功能模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
|
@ -65,11 +55,6 @@
|
||||||
<artifactId>ruoyi-common-sms</artifactId>
|
<artifactId>ruoyi-common-sms</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.dromara</groupId>-->
|
|
||||||
<!-- <artifactId>ruoyi-common-tenant</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
<artifactId>ruoyi-common-security</artifactId>
|
<artifactId>ruoyi-common-security</artifactId>
|
||||||
|
|
|
@ -22,11 +22,6 @@
|
||||||
<artifactId>ruoyi-common-core</artifactId>
|
<artifactId>ruoyi-common-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-common-doc</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
<artifactId>ruoyi-common-mybatis</artifactId>
|
<artifactId>ruoyi-common-mybatis</artifactId>
|
||||||
|
|
|
@ -22,11 +22,6 @@
|
||||||
<artifactId>ruoyi-common-core</artifactId>
|
<artifactId>ruoyi-common-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-common-doc</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
<artifactId>ruoyi-common-mybatis</artifactId>
|
<artifactId>ruoyi-common-mybatis</artifactId>
|
||||||
|
@ -60,10 +55,6 @@
|
||||||
<artifactId>ruoyi-common-sms</artifactId>
|
<artifactId>ruoyi-common-sms</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.dromara</groupId>-->
|
|
||||||
<!-- <artifactId>ruoyi-common-tenant</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package org.dromara.system.domain.vo;
|
package org.dromara.system.domain.vo;
|
||||||
|
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
import org.dromara.common.translation.annotation.Translation;
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
import org.dromara.common.translation.constant.TransConstant;
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
import org.dromara.system.domain.SysNotice;
|
import org.dromara.system.domain.SysNotice;
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
Loading…
Reference in New Issue