springboot-web测试配置

配置

@WebIntegrationTest(randomPort = true)

可以替代

@IntegrationTest(“server.port:0”)
@WebAppConfiguration

完整实例

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = DemoApplication.class)
@WebIntegrationTest
@ActiveProfiles("local")

docs

  • Integration testing on REST urls with Spring Boot

你可能感兴趣的:(java,springboot)