
<bean id="userDao" class="testUserDaoImpl"></bean>
public class MyServlet extends >如何在Java Filter 中注入 Service
@Override
public void init(FilterConfig filterConfig) throws ServletException {
// 初始化方法
ServletContext sc = filterConfiggetServletContext();
XmlWebApplicationContext cxt = (XmlWebApplicationContext)WebApplicationContextUtilsgetWebApplicationContext(sc);
if(cxt != null && logManager == null)
logManager = (LogManager)cxtgetBean("logManager");
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)