How it works...

A Spring Boot test class dedicated to testing Spring Data JPA transactions has a distinct annotation, @DataJpaTest, that configures testing on the JPA persistence layer. It automatically searches for an in-memory database with Hibernate and the Spring Data JPA setup and recognizes JPA entity classes involved in the transactions management. It has an option to use the current DataSource configuration instead of default in-memory database, just by adding @AutoConfigureTestDatabase(replace=Replace.NONE) on the test class. The @DataJpaTest annotation always enables SQL log, thus, running the preceding test method will generate the following output:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.170.187