How to write a unit test for a Spring Boot Controller endpoint

后端 未结 5 708
梦毁少年i
梦毁少年i 2020-12-07 12:22

I have a sample Spring Boot app with the following

Boot main class

@SpringBootApplication
public class DemoApplication {

    public static void mai         


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-07 12:51

    Adding @WebAppConfiguration (org.springframework.test.context.web.WebAppConfiguration) annotation to your DemoApplicationTests class will work.

提交回复
热议问题