这个错误是因为抽象Action类的时候,把ServletContext写成了serverContext,导致无法注入,正确写法是
import javax.annotation.Resource;
import javax.servlet.ServletContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; @Controller
@RequestMapping("/base")
public class BaseAction { @Resource
ServletContext servletContext;
}