@RunWith(SpringRunner.class)@SpringBootTest(classes = Application.class)public class ApplicationTests { @Test public void contextLoads() { }}
但是,如果您想直接测试
Application.main,也可以这样进行测试:
public class ApplicationTest { @Test public void test() { Application.main(new String[]{ "--spring.main.web-environment=false", "--spring.autoconfigure.exclude=blahblahblah", // Override any other environment properties according to your needs }); }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)