0

I want to add gavlyukovskiy Spring Boot DataSource Decorator to log my SQL. In the pom.xml I added the following dependency:

<dependency>
    <groupId>com.github.gavlyukovskiy</groupId>
    <artifactId>p6spy-spring-boot-starter</artifactId>
    <version>1.7.1</version>
</dependency>`

in the application.properties I added:

decorator.datasource.p6spy.enable-logging=true
decorator.datasource.p6spy.multiline=true
decorator.datasource.p6spy.logging=slf4j
decorator.datasource.p6spy.log-file=spy.log
decorator.datasource.p6spy.custom-appender-class=my.custom.LoggerClass
decorator.datasource.p6spy.log-format=
decorator.datasource.p6spy.log-filter.pattern=
decorator.datasource.p6spy.tracing.include-parameter-values=true

I'm developing my programm via JUnit-Tests with Testcontainers in a spring-boot Context. When I run a test I'm getting the following exception:

08:40:35.384 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: Error processing condition on com.github.gavlyukovskiy.boot.jdbc.decorator.p6spy.P6SpyConfiguration.jdbcEventListenerFactory
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60)
...
Caused by: java.lang.IllegalStateException: @ConditionalOnMissingBean did not specify a bean using type, name or annotation and the attempt to deduce the bean's type failed
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition$Spec.validate(OnBeanCondition.java:487)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition$Spec.<init>(OnBeanCondition.java:436)
...
Caused by: java.lang.ClassNotFoundException: com.p6spy.engine.spy.JdbcEventListenerFactory
    at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.springframework.boot.autoconfigure.condition.FilteringSpringBootCondition.resolve(FilteringSpringBootCondition.java:108)
    at 
Hubi
  • 1
  • 1

0 Answers0