feat(datasync): configure Redis and update MyBatis Plus dependency

- Add Redis configuration with host, port, and database settings
- Update MyBatis Plus dependency to Spring Boot 3 starter version
- Configure Maven plugins for dependency management and JAR packaging
- Modify Docker Compose network settings to use external bridge
- Adjust Java mapper scan paths to include nested datasource packages
- Set application to always update strategy in configuration file
master
李一帆 2025-11-18 17:20:24 +08:00
parent 29f4658d91
commit 747e7c5143
4 changed files with 40 additions and 14 deletions

View File

@ -1,6 +1,7 @@
version: '3' version: '3'
networks: networks:
tsg-bridge: tsg_tsg-bridge:
external: true
driver: bridge driver: bridge
services: services:
hsz-redis: hsz-redis:
@ -12,7 +13,7 @@ services:
ports: ports:
- 6369:6379 - 6369:6379
networks: networks:
- tsg-bridge - tsg_tsg-bridge
volumes: volumes:
- /opt/hsz/redis/conf/redis.conf:/usr/local/etc/redis/conf/redis.conf - /opt/hsz/redis/conf/redis.conf:/usr/local/etc/redis/conf/redis.conf
- /opt/hsz/redis/data:/data - /opt/hsz/redis/data:/data
@ -23,7 +24,7 @@ services:
image: openjdk:21 image: openjdk:21
working_dir: /app working_dir: /app
networks: networks:
- tsg-bridge - tsg_tsg-bridge
volumes: volumes:
- /opt/hsz/java:/app - /opt/hsz/java:/app
ports: ports:
@ -40,7 +41,7 @@ services:
image: openjdk:21 image: openjdk:21
working_dir: /app working_dir: /app
networks: networks:
- tsg-bridge - tsg_tsg-bridge
volumes: volumes:
- /opt/hsz/datasync:/app - /opt/hsz/datasync:/app
environment: environment:

View File

@ -35,11 +35,32 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId> <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.gunshi.project.hsz.datasync.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -11,12 +11,12 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication @SpringBootApplication
@EnableScheduling @EnableScheduling
@MapperScan({ @MapperScan({
"com.gunshi.project.hsz.datasync.config", "com.gunshi.project.hsz.datasync.flow.**.datasource",
"com.gunshi.project.hsz.datasync.flow", "com.gunshi.project.hsz.datasync.gnss.**.datasource",
"com.gunshi.project.hsz.datasync.gnss", "com.gunshi.project.hsz.datasync.rainfall.**.datasource",
"com.gunshi.project.hsz.datasync.rainfall", "com.gunshi.project.hsz.datasync.seepage.**.datasource",
"com.gunshi.project.hsz.datasync.seepage", "com.gunshi.project.hsz.datasync.waterLevel.**.datasource",
"com.gunshi.project.hsz.datasync.waterLevel", "com.gunshi.**.mapper"
}) })
public class Main { public class Main {

View File

@ -11,8 +11,6 @@ mybatis-plus:
update-strategy: always update-strategy: always
spring: spring:
profiles:
active: prod
datasource: datasource:
dynamic: dynamic:
primary: master primary: master
@ -31,3 +29,9 @@ spring:
maximum-pool-size: 20 maximum-pool-size: 20
minimum-idle: 5 minimum-idle: 5
connection-timeout: 30000 connection-timeout: 30000
data:
redis:
host: hsz-redis
port: 6379
#password: 1234567a
database: 4