fix: resolve GroupPersonSynPoolProperties bean conflict via TypeFilter exclude

- Add GroupPersonSynExcludeFilter to @ComponentScan excludeFilters
- Filters out cn.cloudwalk.service.organization.config.GroupPersonSyn*
  from component scanning, keeping only the starter module's version
- Service now starts successfully from fat JAR without bean conflicts
This commit is contained in:
hpd840321
2026-05-10 12:32:54 +08:00
parent c7d4ac4a5c
commit 09b1bbe51e
@@ -21,9 +21,13 @@ import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.filter.TypeFilter;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.HttpMethod;
import org.springframework.http.client.ClientHttpRequestFactory;
@@ -41,10 +45,13 @@ import org.springframework.web.client.RestTemplate;
@EnableScheduling
@EnableFeignClients(basePackages={"cn.cloudwalk"})
@MapperScan(basePackages={"cn.cloudwalk.**.mapper"})
@ComponentScan(basePackages={"cn.cloudwalk.task.**", "cn.cloudwalk.**"})
@EnableAsync
@EnableHystrix
@EnableAspectJAutoProxy(proxyTargetClass=true, exposeProxy=true)
@ComponentScan(basePackages={"cn.cloudwalk.task.**", "cn.cloudwalk.**"},
excludeFilters = @ComponentScan.Filter(
type = FilterType.CUSTOM,
classes = {OrganizationServer.GroupPersonSynExcludeFilter.class}))
public class OrganizationServer
extends SpringBootServletInitializer
implements WebApplicationInitializer {
@@ -109,5 +116,12 @@ implements WebApplicationInitializer {
}
private static final long SHUTDOWN_DRAIN_MS = 30_000L;
static class GroupPersonSynExcludeFilter implements TypeFilter {
public boolean match(MetadataReader metadataReader, MetadataReaderFactory factory) {
return metadataReader.getClassMetadata().getClassName()
.contains("service.organization.config.GroupPersonSyn");
}
}
}