1. 程式人生 > >spring boot junit測試的時候報錯MockServerContainer does not support addEndpoint

spring boot junit測試的時候報錯MockServerContainer does not support addEndpoint

在編寫junit測試spring boot專案的時候報錯MockServerContainer does not support addEndpoint 
然自己在@SpringBootTest中加上SpringBootTest.WebEnvironment.RANDOM_PORT成功解決錯誤: 
@RunWith(SpringRunner.class) 
@SpringBootTest(classes = FieldApplication.class,webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)