@AutoWired 出现空指针异常

添加以下设置:
@WebAppConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "file:src/main/webapp/WEB-INF/spring/root-context.xml",
"file:src/main/webapp/WEB-INF/spring/appServlet/controllers.xml",
"file:src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml" })

你可能感兴趣的:(@AutoWired 出现空指针异常)