Getting a compilation error in Maven:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] --------------
As the error is due to the upgrade of Spring Boot from 1.4 to 1.5, its important to note (from below) that several new classes that are introduced in 1.4 deprecated some of the existing classes leading way to finally getting removed in 1.5. The details of such can be found at: Spring boot release notes
Quoted from website (edited):
Additionally, Spring Boot 1.4 (and above) attempts to rationalize and simplify the various ways that a Spring Boot test can be run. You should migrate the following to use the new @SpringBootTest annotation:
From
@SpringApplicationConfiguration(classes=MyConfig.class)to@SpringBootTest(classes=MyConfig.class)From
@ContextConfiguration(classes=MyConfig.class, loader=SpringApplicationContextLoader.class)to@SpringBootTest(classes=MyConfig.class)From
@IntegrationTestto@SpringBootTest(webEnvironment=WebEnvironment.NONE)From
@IntegrationTestwith@WebAppConfigurationto@SpringBootTest(webEnvironment=WebEnvironment.DEFINED_PORT) (or RANDOM_PORT)From
@WebIntegrationTestto@SpringBootTest(webEnvironment=WebEnvironment.DEFINED_PORT) (or RANDOM_PORT)Tip Whilst migrating tests you may also want to replace any
@RunWith(SpringJUnit4ClassRunner.class)declarations with Spring 4.3’s more readable@RunWith(SpringRunner.class).