WebApplicationObjectSupport instance [ResourceHttpRequestHandler [locations=[class path resource [resources/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@12bcd0c0]]] does not run in a WebApplicationContext but in: org.springframework.context.support.GenericApplicationContext@c8e4bb0: startup date [Wed Feb 22 14:28:17 CST 2017]; root of context hierarchy
@ WebApplicationObjectSupport instance [ResourceHttpRequestHandler [locations=[class path resource [resources/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@12bcd0c0]]] does not run in a WebApplicationContext but in: org.springframework.context.support.GenericApplicationContext@c8e4bb0: startup date [Wed Feb 22 14:28:17 CST 2017]; root of context hierarchy
在stackoverflow上找到答案 添加@WebAppConfiguration注解即可