com.transferwise.common.entrypoints.databaseaccessstatistics.DatabaseAccessStatisticsBeanPostProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tw-entrypoints-starter Show documentation
Show all versions of tw-entrypoints-starter Show documentation
Transferwise EntryPoints Starter - Spring Boot Starter for tw-entrypoints
package com.transferwise.common.entrypoints.databaseaccessstatistics;
import com.transferwise.common.entrypoints.BaseEntryPointsBeanProcessor;
import com.transferwise.common.spyql.SpyqlDataSource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
@Slf4j
public class DatabaseAccessStatisticsBeanPostProcessor extends BaseEntryPointsBeanProcessor {
@Value("${tw-entrypoints.das.strictMode:false}")
private boolean strictMode;
@Override
protected void instrument(SpyqlDataSource spyqlDataSource, String databaseName) {
boolean isAlreadyAttached = spyqlDataSource.getDataSourceListeners().stream().anyMatch(
(l) -> l instanceof DatabaseAccessStatisticsSpyqlListener);
if (isAlreadyAttached) {
return;
}
spyqlDataSource.addListener(
new DatabaseAccessStatisticsSpyqlListener(databaseName, strictMode));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy