spring-boot-data-source-decorator icon indicating copy to clipboard operation
spring-boot-data-source-decorator copied to clipboard

Add mechanism to disable decorating in runtime

Open gavlyukovskiy opened this issue 6 years ago • 2 comments
trafficstars

For some projects there is no need in consistent logging of queries, but when some strange behavior was noticed. In this case it would be helpful to be able to disable decorating through spring cloud config.

see https://github.com/p6spy/p6spy/issues/460

gavlyukovskiy avatar Apr 11 '19 00:04 gavlyukovskiy

I might, for instance, like to use P6Spy or datasource-proxy in a test configuration but not in prod; I don't see anything in the README to address this kind of approach.

geoffreywiseman avatar Aug 08 '19 17:08 geoffreywiseman

@geoffreywiseman one option is disable decorating at non test environments (application.properties/yml in main sources) - decorator.datasource.enabled=false, it's mentioned in the very end of README. And then override this option only for tests using either separate test config file or @SpringBootTest(properties = "decorator.datasource.enabled=true"), there are also different options supported by Spring Boot. In this case p6spy/datasource-proxy and decorator code will be on the classpath, but decorating will be disabled. If you want completely exclude it from the classpath you can configure your build tool to make starter a test dependency.

gavlyukovskiy avatar Aug 09 '19 08:08 gavlyukovskiy