Am trying to add custom MetricsExecutionListener for my postgres db. Before SpringBoot 2.3.0 It was likely to be below
@Bean(destroyMethod = "dispose")
ConnectionPool connectionFactory(R2dbcProperties properties,
List<ConnectionFactoryOptionsBuilderCustomizer> customizers) {
ConnectionFactory connectionFactory = ProxyConnectionFactory.builder(ConnectionFactoryBuilder
.create(properties).customize(customizers).build()).listener(dbMetricsExecutionListener).build();
R2dbcProperties.Pool pool = properties.getPool();
ConnectionPoolConfiguration.Builder builder = ConnectionPoolConfiguration.builder(connectionFactory)
.maxSize(pool.getMaxSize()).initialSize(pool.getInitialSize()).maxIdleTime(pool.getMaxIdleTime());
if (StringUtils.hasText(pool.getValidationQuery())) {
builder.validationQuery(pool.getValidationQuery());
}
return new ConnectionPool(builder.build());
}
After Upgrade to SpringBoot 2,3.0 . The ConnectionFactoryBuilder.Create() deprecated. How do we handle it . even referred it in Spring docs. could not resolves this
Comment From: wilkinsona
You can use ConnectionFactoryBuilder.of
in place of the create
method from the experimental auto-configuration.
If you have any further questions, please follow up on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.