@SpringBootTest: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 12: Line 12:
@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT)
@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT)
</syntaxhighlight>
</syntaxhighlight>
The @SpringBootTest annotation also has a properties attribute that can be used to specify any additional properties that should be defined in the environment. Properties are now loaded in the exact same way as Spring’s regular [[@TestPropertySource]] annotation.

Revision as of 00:30, 11 October 2018

Internal

Overview

@SpringBootTest tells to SpringRunner, which is a JUnit plugin that provides custom Spring-specific testing behavior, to bootstrap the test with Spring Boot capabilities:

@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT)

The @SpringBootTest annotation also has a properties attribute that can be used to specify any additional properties that should be defined in the environment. Properties are now loaded in the exact same way as Spring’s regular @TestPropertySource annotation.