This commit is contained in:
cuijiawang 2025-10-13 16:32:54 +08:00
parent a8e2887bbf
commit b366869a00
15 changed files with 249 additions and 64 deletions

View File

@ -18,6 +18,7 @@
<module>wol-common-redis</module>
<module>wol-common-json</module>
<module>wol-common-satoken</module>
<module>wol-common-nacos</module>
</modules>
<packaging>pom</packaging>

View File

@ -52,7 +52,11 @@
<artifactId>wol-common-satoken</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-common-nacos</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@ -1,63 +1,21 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: agileboot
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
dynamic:
primary: master
strict: false
druid:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
datasource:
master:
url: jdbc:mysql://121.41.64.98:3306/agileboot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&sslMode=REQUIRED
username: agileboot
password: 123456
data:
wol:
mysql:
maser:
url: ${MYSQL_URL:121.41.64.98:3306}
username: ${MYSQL_USERNAME:agileboot}
password: ${MYSQL_PASSWORD:123456}
redis:
database: 3
host: 121.41.64.98
port: 6379
password: 'Wyy123123'
database: ${REDIS_DATABASE:3}
host: ${REDIS_HOST:121.41.64.98}
port: ${REDIS_PORT:6379}
password: ${REDIS_PASSWORD:'Wyy123123'}
nacos:
server:
addr: ${NACOS_ADDR:192.168.110.27:8848}
username: ${NACOS_USERNAME:nacos}
password: ${NACOS_PASSWORD:nacos}
namespace: ${NACOS_NAMESPACE:public}
group: ${NACOS_GROUP:DEFAULT_GROUP}
jasypt:
encryptor:
password: ${JASYPT_ENCRYPTOR_PASSWORD:}

View File

@ -30,3 +30,58 @@ mybatis-plus:
insertStrategy: NOT_NULL
updateStrategy: NOT_NULL
whereStrategy: NOT_NULL
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: agileboot
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
dynamic:
primary: master
strict: false
druid:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
datasource:
master:
url: jdbc:mysql://${wol.mysql.maser.url}/agileboot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: ${wol.mysql.maser.username}
password: ${wol.mysql.maser.password}

View File

@ -0,0 +1,38 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-common</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>wol-common-nacos</artifactId>
<dependencies>
<!-- Nacos 服务注册与发现-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 配置中心 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- Spring Boot 3 + Spring Cloud 2023 默认不启用 bootstrap -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,18 @@
spring:
cloud:
nacos:
discovery:
server-addr: ${wol.nacos.server.addr}
username: ${wol.nacos.server.username}
password: ${wol.nacos.server.password}
group: ${wol.nacos.server.group}
namespace: ${wol.nacos.server.namespace}
config:
server-addr: ${wol.nacos.server.addr}
group: ${wol.nacos.server.group}
namespace: ${wol.nacos.server.namespace}
file-extension: yaml
refresh-enabled: true # 是否开启动态刷新
name: ${spring.application.name}
username: ${wol.nacos.server.username}
password: ${wol.nacos.server.password}

View File

@ -40,6 +40,19 @@
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<!-- JetCache -->
<!-- <dependency>-->
<!-- <groupId>com.alicp.jetcache</groupId>-->
<!-- <artifactId>jetcache-starter-redisson</artifactId>-->
<!-- <version>2.7.5</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-logging</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
</dependencies>
</project>

View File

@ -1,5 +1,6 @@
package com.agileboot.common.redis.config;
import com.agileboot.common.core.factory.YmlPropertySourceFactory;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.PropertyAccessor;
@ -12,6 +13,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
@ -19,6 +21,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
@Slf4j
@AutoConfiguration
@PropertySource(value = "classpath:common-cache.yml", factory = YmlPropertySourceFactory.class)
public class RedisConfiguration {
@Bean

View File

@ -0,0 +1,46 @@
spring:
data:
redis:
database: ${wol.redis.database}
host: ${wol.redis.host}
port: ${wol.redis.port}
password: ${wol.redis.password}
redis:
redisson:
config: |
singleServerConfig:
idleConnectionTimeout: 10000
connectTimeout: 10000
timeout: 3000
retryAttempts: 3
retryInterval: 1500
password: ${wol.redis.password}
subscriptionsPerConnection: 5
clientName: null
address: "redis://${wol.redis.host}:${wol.redis.port}"
subscriptionConnectionMinimumIdleSize: 1
subscriptionConnectionPoolSize: 50
connectionMinimumIdleSize: 24
connectionPoolSize: 64
database: 0
dnsMonitoringInterval: 5000
threads: 16
nettyThreads: 32
codec: !<org.redisson.client.codec.StringCodec> {}
transportMode: "NIO"
jetcache:
statIntervalMinutes: 1
areaInCacheName: false
local:
default:
type: caffeine
keyConvertor: fastjson2
remote:
default:
type: redisson
keyConvertor: fastjson2
broadcastChannel: ${spring.application.name}
keyPrefix: ${spring.application.name}
valueEncoder: java
valueDecoder: java
defaultExpireInMillis: 5000

View File

@ -22,6 +22,11 @@
<artifactId>agileboot-system-base</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-common-nacos</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@ -16,6 +16,12 @@
</properties>
<dependencies>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-common-nacos</artifactId>
</dependency>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-common-satoken</artifactId>
@ -31,16 +37,27 @@
<groupId>cn.dev33</groupId>
<artifactId>sa-token-reactor-spring-boot3-starter</artifactId>
<version>${satoken.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,6 @@
FROM amazoncorretto:17
MAINTAINER 1293433164@qq.com
ADD target/wol-gateway-1.0.0.jar /gateway.jar
EXPOSE 18080
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
ENTRYPOINT ["java", "-jar", "/gateway.jar"]

View File

@ -8,4 +8,11 @@ spring:
application:
name: @application.name@
config:
import: classpath:base.yml
import: classpath:base.yml,classpath:nacos.yml
logging:
level:
root: INFO
org.springframework.cloud.gateway: DEBUG
com.alibaba.nacos: DEBUG
org.springframework.boot: DEBUG

View File

@ -0,0 +1,5 @@
spring:
application:
name: @application.name@
config:
import: classpath:base.yml,classpath:nacos.yml

View File

@ -32,6 +32,7 @@
<java.version>17</java.version>
<spring.boot.version>3.4.7</spring.boot.version>
<spring-cloud.version>2024.0.0</spring-cloud.version>
<spring-cloud-alibaba.version>2023.0.3.3</spring-cloud-alibaba.version>
<mybatis.version>3.5.16</mybatis.version>
<mybatis-plus.version>3.5.12</mybatis-plus.version>
<dynamic-ds.version>4.3.1</dynamic-ds.version>
@ -72,6 +73,14 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- SpringBoot的依赖配置-->
<dependency>
<groupId>org.springframework.boot</groupId>