spingboot非controller类 junit测试类中获取request response对象

@SpringBootTest(classes = {ShujiegouApplication.class})
@RunWith(SpringJUnit4ClassRunner.class)
public class EasyPoiExportTest {

    private static final Logger logger = LogManager.getLogger(EasyPoiExportTest.class);

    //声明request变量
    private MockHttpServletResponse response;
    private MockHttpServletRequest request;
}

这辈子坚持与不坚持都不可怕,怕的是独自走在坚持的道路上!

你可能感兴趣的:(springboot)