Skip to content

Commit ba6a02e

Browse files
authored
Update README.md
1 parent 7281b5e commit ba6a02e

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,21 @@ It consists of just an Hibernate SQL inspector service and a Spring Test Listene
2424
## How to integrate
2525
- Register the SQL inspector service in the registry, you just need to add this key in your configuration (here for yml):
2626

27-
28-
spring:
29-
jpa:
30-
properties:
31-
hibernate.session_factory.statement_inspector: com.lemick.integration.hibernate.HibernateStatementCountInspector
27+
spring:
28+
jpa:
29+
properties:
30+
hibernate.session_factory.statement_inspector: com.lemick.integration.hibernate.HibernateStatementCountInspector
3231

3332
- Register the Spring TestListener that will launch the SQL inspection is the annotation is present
33+
By adding the listener on each of your integration test:
34+
35+
@SpringBootTest(webEnvironment = RANDOM_PORT)
36+
@TestExecutionListeners(listeners = HibernateStatementCountTestListener.class, mergeMode = TestExecutionListeners.MergeMode.MERGE_WITH_DEFAULTS)
37+
class TestDatasourceProxyApplicationTests {
38+
...
39+
}
40+
41+
Or globally by adding a META-INF/spring.factories file that contains the listener:
42+
43+
org.springframework.test.context.TestExecutionListener=com.lemick.integration.spring.HibernateStatementCountTestListener
44+

0 commit comments

Comments
 (0)