Reputation: 41560
For a normal data source I would do the following using P6Spy
@Configuration
@Order(LOWEST_PRECEDENCE)
@Slf4j
public class DataSourceBeanPostProcessor implements BeanPostProcessor {
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof DataSource && !ScopedProxyUtils.isScopedTarget(beanName)) {
log.debug("Decorating {} with P6Spy", bean);
return new P6DataSource((DataSource) bean);
} else {
return bean;
}
}
}
But since R2BC uses a reactive DataSource how would I instrument that?
Upvotes: 0
Views: 344
Reputation: 6911
P6Spy (and datasource-proxy) is for JDBC not for R2DBC. R2DBC has its own proxy (formerly: datasource-proxy-r2dbc): https://github.com/r2dbc/r2dbc-proxy
Upvotes: 0