6 Spring Professional Certification Practice Tests 2V0-72.22

Why take this course?
-
The
@DataJpaTest
annotation auto-configures the following:• Caching • Spring Data JPA repositories • Embedded in-memory database (test database) as the DataSource • Data source transaction manager • JdbcTemplate • Flyway or Liquibase database migration tool (depending on your configuration) • JPA base configuration for Hibernate • Spring transaction management • Test profiles such as
@ActiveProfiles("test")
which activates configurations in theTestConfiguration
class. • A test database • A JPA entity manager for tests -
The
@SpringBootTest
annotation provides four different types of web environments:• MOCK: Provides a mock web environment, useful when you don't want to start a real server. • RANDOM_PORT: Starts an embedded web server on a random port. • DEFINED_PORT: Starts an embedded web server on a port specified in the
server.port
property or defaults to 8080 if not set. • NONE: Doesn't start any web environment at all. • SERVLET_CONTEXT: A less commonly used option that allows for a servlet context to be provided, useful when integrating with a particular servlet container configuration.
These options help you test your Spring Boot application in different environments without having to set up separate environments for each test case.
Loading charts...