diff --git a/changes/en-us/develop.md b/changes/en-us/develop.md index f7fda43a0c4..e6adc33c449 100644 --- a/changes/en-us/develop.md +++ b/changes/en-us/develop.md @@ -42,7 +42,7 @@ Add changes here for all PR submitted to the develop branch. - [[#5092](https://github.com/seata/seata/pull/5092)] fix when seata and jpa are used together, their AutoConfiguration order is incorrect - [[#5109](https://github.com/seata/seata/pull/5109)] fix NPE caused when there is no @GlobalTransactional annotation on the RM side - [[#5131](https://github.com/seata/seata/pull/5131)] rollback active xa connection fail - +- [[#5134](https://github.com/seata/seata/pull/5134)] hikari datasource auto proxy fail ### optimize: - [[#4774](https://github.com/seata/seata/pull/4774)] optimize mysql8 dependencies for seataio/seata-server image diff --git a/changes/zh-cn/develop.md b/changes/zh-cn/develop.md index f6a58881c29..81bfde44e06 100644 --- a/changes/zh-cn/develop.md +++ b/changes/zh-cn/develop.md @@ -43,6 +43,7 @@ - [[#5092](https://github.com/seata/seata/pull/5092)] 修复当seata and jpa共同使用时, AutoConfiguration的顺序不正确的问题 - [[#5109](https://github.com/seata/seata/pull/5109)] 修复当RM侧没有加@GlobalTransactional报NPE的问题 - [[#5131](https://github.com/seata/seata/pull/5131)] 修复xaconnection处于active状态时无法回滚的问题 +- [[#5134](https://github.com/seata/seata/pull/5134)] 修复hikariDataSource 自动代理在某些情况下失效的问题 ### optimize: - [[#4681](https://github.com/seata/seata/pull/4681)] 优化竞争锁过程 diff --git a/seata-spring-boot-starter/src/main/java/io/seata/spring/boot/autoconfigure/SeataDataSourceAutoConfiguration.java b/seata-spring-boot-starter/src/main/java/io/seata/spring/boot/autoconfigure/SeataDataSourceAutoConfiguration.java index e9222538f9f..1df129143fe 100644 --- a/seata-spring-boot-starter/src/main/java/io/seata/spring/boot/autoconfigure/SeataDataSourceAutoConfiguration.java +++ b/seata-spring-boot-starter/src/main/java/io/seata/spring/boot/autoconfigure/SeataDataSourceAutoConfiguration.java @@ -16,14 +16,15 @@ package io.seata.spring.boot.autoconfigure; import javax.sql.DataSource; - import io.seata.spring.annotation.datasource.SeataAutoDataSourceProxyCreator; import io.seata.spring.boot.autoconfigure.properties.SeataProperties; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.AutoConfigureOrder; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; +import org.springframework.core.Ordered; import static io.seata.spring.annotation.datasource.AutoDataSourceProxyRegistrar.BEAN_NAME_SEATA_AUTO_DATA_SOURCE_PROXY_CREATOR; @@ -34,7 +35,9 @@ */ @ConditionalOnBean(DataSource.class) @ConditionalOnExpression("${seata.enabled:true} && ${seata.enableAutoDataSourceProxy:true} && ${seata.enable-auto-data-source-proxy:true}") -@AutoConfigureAfter({SeataCoreAutoConfiguration.class}) +@AutoConfigureOrder(Ordered.LOWEST_PRECEDENCE) +@AutoConfigureAfter(value = {SeataCoreAutoConfiguration.class}, + name = "org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration") public class SeataDataSourceAutoConfiguration { /** @@ -46,4 +49,5 @@ public SeataAutoDataSourceProxyCreator seataAutoDataSourceProxyCreator(SeataProp return new SeataAutoDataSourceProxyCreator(seataProperties.isUseJdkProxy(), seataProperties.getExcludesForAutoProxying(), seataProperties.getDataSourceProxyMode()); } + }