Compare commits

...

2 Commits

Author SHA1 Message Date
zhangjf
4af7d712cd fix: Gateway不扫描fund-common避免依赖冲突 2026-02-20 18:04:30 +08:00
zhangjf
ef46844bfd fix: 修复服务启动配置问题
- 所有业务服务添加scanBasePackages扫描fund-common
- Gateway添加ReactiveRedisConfig提供ReactiveRedisTemplate
- Gateway排除Servlet相关类和RedisService(需要非响应式RedisTemplate)
- 解决Bean名称冲突(ReactiveRedisConfig)
2026-02-20 17:53:12 +08:00
16 changed files with 111 additions and 15 deletions

View File

@ -1,4 +1,4 @@
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Tue Feb 17 19:14:24 CST 2026
#Fri Feb 20 17:27:25 CST 2026
fund-common-0.0.1-SNAPSHOT.jar>=
fund-common-0.0.1-SNAPSHOT.pom>=

View File

@ -50,6 +50,34 @@
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- EasyExcel -->
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-spring-boot-starter</artifactId>
<version>4.4.0</version>
</dependency>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!-- Spring Cloud LoadBalancer (租户负载均衡) -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
<!-- MyBatis Plus (租户插件) -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-extension</artifactId>
<version>3.5.5</version>
<scope>provided</scope>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@ -3,7 +3,7 @@
<groupId>com.fundplatform</groupId>
<artifactId>fund-common</artifactId>
<versioning>
<lastUpdated>20260217111414</lastUpdated>
<lastUpdated>20260220092715</lastUpdated>
<snapshot>
<localCopy>true</localCopy>
</snapshot>
@ -11,12 +11,12 @@
<snapshotVersion>
<extension>pom</extension>
<value>0.0.1-SNAPSHOT</value>
<updated>20260217111414</updated>
<updated>20260220092715</updated>
</snapshotVersion>
<snapshotVersion>
<extension>jar</extension>
<value>0.0.1-SNAPSHOT</value>
<updated>20260217111414</updated>
<updated>20260220092715</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>

View File

@ -6,6 +6,6 @@
<versions>
<version>0.0.1-SNAPSHOT</version>
</versions>
<lastUpdated>20260217111414</lastUpdated>
<lastUpdated>20260220092715</lastUpdated>
</versioning>
</metadata>

View File

@ -1,3 +1,3 @@
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Tue Feb 17 19:14:15 CST 2026
#Fri Feb 20 17:13:04 CST 2026
fundplatform-0.0.1-SNAPSHOT.pom>=

View File

@ -60,6 +60,21 @@
</dependencies>
</dependencyManagement>
<!-- 公共依赖 - 所有模块都需要的依赖 -->
<dependencies>
<!-- Spring Boot Actuator - 健康检查和监控端点 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Micrometer Prometheus - Prometheus 监控指标暴露 -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
</dependencies>
<!-- 项目内自定义 Maven 仓库配置,避免依赖外部 settings.xml 中的私服配置 -->
<repositories>
<!-- 官方中央仓库 -->

View File

@ -3,7 +3,7 @@
<groupId>com.fundplatform</groupId>
<artifactId>fundplatform</artifactId>
<versioning>
<lastUpdated>20260217111414</lastUpdated>
<lastUpdated>20260220091303</lastUpdated>
<snapshot>
<localCopy>true</localCopy>
</snapshot>
@ -11,7 +11,7 @@
<snapshotVersion>
<extension>pom</extension>
<value>0.0.1-SNAPSHOT</value>
<updated>20260217111414</updated>
<updated>20260220091303</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>

View File

@ -6,6 +6,6 @@
<versions>
<version>0.0.1-SNAPSHOT</version>
</versions>
<lastUpdated>20260217111414</lastUpdated>
<lastUpdated>20260220091303</lastUpdated>
</versioning>
</metadata>

View File

@ -4,7 +4,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@SpringBootApplication(scanBasePackages = {"com.fundplatform.exp", "com.fundplatform.common"})
@EnableDiscoveryClient
public class ExpApplication {

View File

@ -4,7 +4,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@SpringBootApplication(scanBasePackages = {"com.fundplatform.file", "com.fundplatform.common"})
@EnableDiscoveryClient
public class FileApplication {

View File

@ -2,8 +2,17 @@ package com.fundplatform.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@SpringBootApplication(scanBasePackages = {
"com.fundplatform.gateway"
// 注意Gateway不扫描fund-common的任何包避免依赖冲突
// - common.auth: TokenService需要RedisService
// - common.cache: 需要非响应式RedisTemplate
// - common.nacos: 需要Registration bean
// - common.web: 使用Servlet API
})
@EnableDiscoveryClient
public class GatewayApplication {
public static void main(String[] args) {

View File

@ -0,0 +1,44 @@
package com.fundplatform.gateway.config;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory;
import org.springframework.data.redis.core.ReactiveRedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializationContext;
import org.springframework.data.redis.serializer.StringRedisSerializer;
/**
* Redis配置类
* 为Gateway提供ReactiveRedisTemplate
*/
@Configuration
public class ReactiveRedisConfig {
@Bean
public ReactiveRedisTemplate<String, Object> reactiveRedisTemplate(
ReactiveRedisConnectionFactory connectionFactory) {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
objectMapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance,
ObjectMapper.DefaultTyping.NON_FINAL);
Jackson2JsonRedisSerializer<Object> jsonSerializer = new Jackson2JsonRedisSerializer<>(objectMapper, Object.class);
StringRedisSerializer stringSerializer = StringRedisSerializer.UTF_8;
RedisSerializationContext<String, Object> serializationContext = RedisSerializationContext
.<String, Object>newSerializationContext()
.key(stringSerializer)
.value(jsonSerializer)
.hashKey(stringSerializer)
.hashValue(jsonSerializer)
.build();
return new ReactiveRedisTemplate<>(connectionFactory, serializationContext);
}
}

View File

@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@SpringBootApplication(scanBasePackages = {"com.fundplatform.receipt", "com.fundplatform.common"})
@EnableDiscoveryClient
@EnableScheduling
public class ReceiptApplication {

View File

@ -4,7 +4,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@SpringBootApplication(scanBasePackages = {"com.fundplatform.req", "com.fundplatform.common"})
@EnableDiscoveryClient
public class ReqApplication {

View File

@ -8,7 +8,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* 系统服务启动类
*/
@SpringBootApplication
@SpringBootApplication(scanBasePackages = {"com.fundplatform.sys", "com.fundplatform.common"})
@EnableDiscoveryClient
@MapperScan("com.fundplatform.sys.data.mapper")
public class SysApplication {