Prevent Application / CommandLineRunner classes from executing during JUnit testing

前端 未结 7 1512
既然无缘
既然无缘 2020-12-07 22:47

If in your TestCase class there is this annotations:

@SpringApplicationConfiguration(classes = {Application.class})

this will cause the

7条回答
  •  猫巷女王i
    2020-12-07 22:58

    If you have a mocking framework installed (e.g. MockMVC) you can create a mock instance of the CommandLineRunner implementation, more or less disabling it:

    @MockBean private TextProcessor myProcessor;

提交回复
热议问题