需要帮忙
@Configuration
@EnableR2dbcRepositories(basePackages = "com.paymentservice.repository", databaseClientRef = "databaseClient")
public class PaymentR2dbcConfiguration extends AbstractR2dbcConfiguration {
@Value("${payment.data.mssql.host}")
private String host;
@Value("${payment.data.mssql.port}")
private int port;
@Value("${payment.data.mssql.database}")
private String database;
@Value("${payment.data.mssql.username}")
private String username;
@Value("${payment.data.mssql.password}")
private String password;
/**
* An implementation of {@link ConnectionFactory} for creating connections to
* a Microsoft SQL Server database using R2DBC.
*
* @return A factory for creating {@link Connection}s.
*/
@Override
public ConnectionFactory connectionFactory() {
return new MssqlConnectionFactory(
MssqlConnectionConfiguration.builder()
.host(host)
.port(port)
.database(database)
.username(username)
.password(password).build());
}
}
我越来越
quote 在类路径资源 [org/springframework/boot/autoconfigure/data/r2dbc/R2dbcDataAutoConfiguration.class] 中定义的 bean 'r2dbcDatabaseClient' 无法注册。已在类路径资源 [com/paymentservice/configurations/PaymentR2dbcConfiguration.class] 中定义了具有该名称的 bean,并且禁用了覆盖。
我在用着
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-r2dbc</artifactId>
<version>1.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-mssql</artifactId>
<version>0.8.4.RELEASE</version>
</dependency>