in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

谁说我不能喝 提交于 2019-11-29 15:29:32
Phil Webb

Test slice annotations aren't really designed to be composed like that. Your code worked in Spring Boot 2.0 only by luck I'm afraid.

You really need to pick just one @...Test annotation and then combine it with one or more @AutoConfigure... annotations. For the example above, I would write:

@RunWith(SpringRunner.class)
@JdbcTest
@AutoConfigureJson
@AutoConfigureJsonTesters
public class Test {

  @Test
  public void test() { 
    System.out.println("Hello, World !"); 
  }

}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!