|
1 | 1 | package org.baeldung.controller; |
2 | 2 |
|
3 | | -import javax.servlet.ServletContext; |
4 | | - |
| 3 | +import com.fasterxml.jackson.databind.ObjectMapper; |
5 | 4 | import org.baeldung.controller.config.WebConfig; |
6 | 5 | import org.baeldung.controller.student.Student; |
7 | 6 | import org.junit.Assert; |
|
11 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
12 | 11 | import org.springframework.test.context.ContextConfiguration; |
13 | 12 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
14 | | -import org.springframework.test.context.support.AnnotationConfigContextLoader; |
| 13 | +import org.springframework.test.context.web.AnnotationConfigWebContextLoader; |
15 | 14 | import org.springframework.test.context.web.WebAppConfiguration; |
16 | 15 | import org.springframework.test.web.servlet.MockMvc; |
17 | 16 | import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; |
18 | 17 | import org.springframework.test.web.servlet.setup.MockMvcBuilders; |
19 | 18 | import org.springframework.web.context.WebApplicationContext; |
20 | 19 | import org.springframework.web.servlet.ModelAndView; |
21 | 20 |
|
22 | | -import com.fasterxml.jackson.databind.ObjectMapper; |
23 | | - |
24 | 21 |
|
25 | 22 | @RunWith(SpringJUnit4ClassRunner.class) |
26 | 23 | @WebAppConfiguration |
27 | | -@ContextConfiguration(classes={WebConfig.class},loader=AnnotationConfigContextLoader.class ) |
| 24 | +@ContextConfiguration(classes={WebConfig.class}, loader=AnnotationConfigWebContextLoader.class ) |
28 | 25 | public class ControllerAnnotationTest { |
29 | 26 |
|
30 | | - @Autowired |
31 | 27 | private MockMvc mockMvc; |
32 | 28 |
|
33 | 29 | @Autowired |
34 | 30 | private WebApplicationContext wac; |
35 | 31 |
|
36 | | - @Autowired |
37 | | - private ServletContext servletContext; |
38 | | - |
39 | 32 | private Student selectedStudent; |
40 | 33 |
|
41 | 34 | @Before |
|
0 commit comments