diff --git a/hmily-tcc-admin/src/main/java/com/hmily/tcc/admin/service/compensate/JdbcCompensationServiceImpl.java b/hmily-tcc-admin/src/main/java/com/hmily/tcc/admin/service/compensate/JdbcCompensationServiceImpl.java index 85d64a82..01d42d6f 100644 --- a/hmily-tcc-admin/src/main/java/com/hmily/tcc/admin/service/compensate/JdbcCompensationServiceImpl.java +++ b/hmily-tcc-admin/src/main/java/com/hmily/tcc/admin/service/compensate/JdbcCompensationServiceImpl.java @@ -30,6 +30,7 @@ import com.hmily.tcc.common.utils.RepositoryPathUtils; import lombok.RequiredArgsConstructor; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import java.util.List; @@ -45,7 +46,8 @@ import java.util.stream.Collectors; @RequiredArgsConstructor public class JdbcCompensationServiceImpl implements CompensationService { - private final JdbcTemplate jdbcTemplate; + @Autowired + private JdbcTemplate jdbcTemplate; private String dbType; diff --git a/hmily-tcc-admin/src/main/java/com/hmily/tcc/admin/spi/CompensationConfiguration.java b/hmily-tcc-admin/src/main/java/com/hmily/tcc/admin/spi/CompensationConfiguration.java index 1f434e08..5e653790 100644 --- a/hmily-tcc-admin/src/main/java/com/hmily/tcc/admin/spi/CompensationConfiguration.java +++ b/hmily-tcc-admin/src/main/java/com/hmily/tcc/admin/spi/CompensationConfiguration.java @@ -73,12 +73,9 @@ public class CompensationConfiguration { private final Environment env; - private final JdbcTemplate jdbcTemplate; - @Autowired - JdbcRecoverConfiguration(final Environment env, final JdbcTemplate jdbcTemplate) { + JdbcRecoverConfiguration(final Environment env) { this.env = env; - this.jdbcTemplate = jdbcTemplate; } @Bean @@ -98,7 +95,7 @@ public class CompensationConfiguration { @Bean @Qualifier("jdbcTransactionRecoverService") public CompensationService jdbcTransactionRecoverService() { - JdbcCompensationServiceImpl jdbcTransactionRecoverService = new JdbcCompensationServiceImpl(jdbcTemplate); + JdbcCompensationServiceImpl jdbcTransactionRecoverService = new JdbcCompensationServiceImpl(); jdbcTransactionRecoverService.setDbType(env.getProperty("compensation.db.driver")); return jdbcTransactionRecoverService; } diff --git a/hmily-tcc-admin/src/main/resources/application-db.yml b/hmily-tcc-admin/src/main/resources/application-db.yml index 9f7010de..2bd6159f 100644 --- a/hmily-tcc-admin/src/main/resources/application-db.yml +++ b/hmily-tcc-admin/src/main/resources/application-db.yml @@ -1,6 +1,6 @@ compensation: db: driver : com.mysql.jdbc.Driver - url: jdbc:mysql://192.168.1.68:3306/tx?useUnicode=true&characterEncoding=utf8 - username: xiaoyu - password: Wgj@555888 + url: jdbc:mysql://192.168.1.98:3306/tcc?useUnicode=true&characterEncoding=utf8 + username: root + password: 123456