springboot集成seata,nacos更改配置文件导致 DruidDataSource一直closing,NacosPropertySourceBuilder反复监听,一直循环
<spring-cloud-alibaba-dependencies.version>2021.0.4.0</spring-cloud-alibaba-dependencies.version>
<spring-boot-dependencies.version>2.6.11</spring-boot-dependencies.version>
<spring-cloud-dependencies.version>2021.0.4</spring-cloud-dependencies.version>
集成seata1.5.2
nacos动态管理配置文件,修改后,控制提示,
[user-center:192.168.1.206:7000] 2025-01-14 08:31:16.222 INFO 33068 [-] [nacos.client.cachedata.internal.notifier] com.alibaba.druid.pool.DruidDataSource {dataSource-2} closing ...
[user-center:192.168.1.206:7000] 2025-01-14 08:31:20.526 WARN 33068 [-] [nacos.client.cachedata.internal.notifier] c.a.c.n.c.NacosPropertySourceBuilder Ignore the empty nacos configuration and get it based on dataId[user-center] & group[DEFAULT_GROUP]
[user-center:192.168.1.206:7000] 2025-01-14 08:31:20.539 WARN 33068 [-] [nacos.client.cachedata.internal.notifier] c.a.c.n.c.NacosPropertySourceBuilder Ignore the empty nacos configuration and get it based on dataId[user-center-labour.yml] & group[DEFAULT_GROUP]
[user-center:192.168.1.206:7000] 2025-01-14 08:31:20.539 INFO 33068 [-] [nacos.client.cachedata.internal.notifier] b.c.PropertySourceBootstrapConfiguration Located property source: [BootstrapPropertySource {name='bootstrapProperties-user-center-labour.yml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-user-center.yml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-user-center,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-saas_common.yml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-common.yml,DEFAULT_GROUP'}]
[user-center:192.168.1.206:7000] 2025-01-14 08:31:20.586 INFO 33068 [-] [nacos.client.cachedata.internal.notifier] o.s.boot.SpringApplication The following 1 profile is active: "labour"
[user-center:192.168.1.206:7000] 2025-01-14 08:31:20.628 INFO 33068 [-] [nacos.client.cachedata.internal.notifier] o.s.boot.SpringApplication Started application in 1.399 seconds (JVM running for 33463.133)
[user-center:192.168.1.206:7000] 2025-01-14 08:31:21.270 INFO 33068 [-] [nacos.client.cachedata.internal.notifier] com.alibaba.druid.pool.DruidDataSource {dataSource-2} closing ...
seata配置
@Configuration
@PropertySource(factory = YamlPropertySourceFactory.class, value = "classpath:saas-seata.yml")
public class SeataConfiguration {
@Bean
@ConfigurationProperties(prefix = "spring.datasource.druid")
public DruidDataSource druidDataSource() {
return DruidDataSourceBuilder.create().build();
}
@Primary
@Bean
public DataSourceProxy dataSourceProxy(DruidDataSource druidDataSource) {
return new DataSourceProxy(druidDataSource);
}
}
<!-- seata-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
<exclusions>
<exclusion>
<artifactId>druid</artifactId>
<groupId>com.alibaba</groupId>
</exclusion>
</exclusions>
</dependency>
启动时候 @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
不集成seata,则正常日志
[uaa-server:192.168.1.206:8000] 2025-01-14 09:02:04.927 WARN 42556 [-] [nacos.client.cachedata.internal.notifier] c.a.c.n.c.NacosPropertySourceBuilder Ignore the empty nacos configuration and get it based on dataId[uaa-server] & group[DEFAULT_GROUP]
[uaa-server:192.168.1.206:8000] 2025-01-14 09:02:04.968 WARN 42556 [-] [nacos.client.cachedata.internal.notifier] c.a.c.n.c.NacosPropertySourceBuilder Ignore the empty nacos configuration and get it based on dataId[uaa-server-labour.yml] & group[DEFAULT_GROUP]
[uaa-server:192.168.1.206:8000] 2025-01-14 09:02:04.968 INFO 42556 [-] [nacos.client.cachedata.internal.notifier] b.c.PropertySourceBootstrapConfiguration Located property source: [BootstrapPropertySource {name='bootstrapProperties-uaa-server-labour.yml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-uaa-server.yml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-uaa-server,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-saas_common.yml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-common.yml,DEFAULT_GROUP'}]
[uaa-server:192.168.1.206:8000] 2025-01-14 09:02:05.047 INFO 42556 [-] [nacos.client.cachedata.internal.notifier] o.s.boot.SpringApplication The following 1 profile is active: "labour"
[uaa-server:192.168.1.206:8000] 2025-01-14 09:02:05.064 INFO 42556 [-] [nacos.client.cachedata.internal.notifier] o.s.boot.SpringApplication Started application in 1.917 seconds (JVM running for 36283.472)
[uaa-server:192.168.1.206:8000] 2025-01-14 09:02:05.939 INFO 42556 [-] [nacos.client.cachedata.internal.notifier] com.alibaba.druid.pool.DruidDataSource {dataSource-1} closing ...
[uaa-server:192.168.1.206:8000] 2025-01-14 09:02:06.600 INFO 42556 [-] [nacos.client.cachedata.internal.notifier] o.s.c.e.event.RefreshEventListener Refresh keys changed: