在类名上添加注解 @Component 在init()中添加如下代码 super.init(); ServletContext application = this.getServletContext(); // 解决servlet用@Autowired自动注入service失败的问题 SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, application); 每个人都有潜在的能量,只是很容易。被习惯所掩盖,被时间所迷离,被惰性所消磨。