스프링 MCQ 컨트롤러에서 테스트를하려고하는데 내 applicationContext는 항상 null입니다.WebApplicationContext에서 @Autowired Spring MVC 테스트가 작동하지 않습니다.
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.web.WebAppConfiguration
import org.springframework.test.web.servlet.MockMvc
import org.springframework.test.web.servlet.ResultActions
import org.springframework.test.web.servlet.setup.MockMvcBuilders
import org.springframework.web.context.WebApplicationContext
import spock.unitils.UnitilsSupport
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
@UnitilsSupport
@WebAppConfiguration
//@ContextConfiguration(classes=Config.class)
//@ContextConfiguration(loader= ApplicationContextProvider.class)
class TimeSheetControllerIt extends TestsSupport {
@Autowired
private WebApplicationContext webApplicationContext; //NULL
//private MockHttpServletRequest mockHttpServletRequest;
private MockMvc mockMvc
private ResultActions resultActions
def setup(){
//this.mockHttpServletRequest = new MockHttpServletRequest();
this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
}
어떻게해야합니까?