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

View File

@ -35,11 +35,32 @@
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
</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>

View File

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

View File

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