mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-09 08:20:31 +08:00
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:
+15
-1
@@ -21,9 +21,13 @@ import org.springframework.cloud.netflix.hystrix.EnableHystrix;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||||
|
import org.springframework.context.annotation.FilterType;
|
||||||
import org.springframework.context.event.ContextClosedEvent;
|
import org.springframework.context.event.ContextClosedEvent;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.core.annotation.Order;
|
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.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||||
@@ -41,10 +45,13 @@ import org.springframework.web.client.RestTemplate;
|
|||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@EnableFeignClients(basePackages={"cn.cloudwalk"})
|
@EnableFeignClients(basePackages={"cn.cloudwalk"})
|
||||||
@MapperScan(basePackages={"cn.cloudwalk.**.mapper"})
|
@MapperScan(basePackages={"cn.cloudwalk.**.mapper"})
|
||||||
@ComponentScan(basePackages={"cn.cloudwalk.task.**", "cn.cloudwalk.**"})
|
|
||||||
@EnableAsync
|
@EnableAsync
|
||||||
@EnableHystrix
|
@EnableHystrix
|
||||||
@EnableAspectJAutoProxy(proxyTargetClass=true, exposeProxy=true)
|
@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
|
public class OrganizationServer
|
||||||
extends SpringBootServletInitializer
|
extends SpringBootServletInitializer
|
||||||
implements WebApplicationInitializer {
|
implements WebApplicationInitializer {
|
||||||
@@ -109,5 +116,12 @@ implements WebApplicationInitializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final long SHUTDOWN_DRAIN_MS = 30_000L;
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user