这是我的设置:
测试班
@ActiveProfiles("test")
@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
class RepositoryTest {
...
构建.gradle
implementation "p6spy:p6spy:3.9.1"
应用程序-test.yml
spring:
datasource:
url: jdbc:p6spy:h2:mem:private
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
logging:
level:
p6spy: DEBUG
com.p6spy: DEBUG
spy.properties - 我在 src/main/resources 和 /srt/test/resources 下添加了它
appender=com.p6spy.engine.spy.appender.Slf4JLogger
我仍然没有得到任何 SQL 命令的日志