过滤器用读取前后文的方法调用dao层

过滤器用读取上下文的方法调用dao层

过滤器中的代码

String store_path = request.getServletContext()  

                .getRealPath("/WEB-INF/");  

        ApplicationContext context = new FileSystemXmlApplicationContext(  

                store_path + "/spring/applicationContext.xml");  

        IUserDao ud = (IUserDao) context  

                .getBean("IUserDao");  

        IEnterpriseDao ed = (IEnterpriseDao) context  

                .getBean("IEnterpriseDao"); 

 

applicationContext.xml  是用的自动注解的方式配置bean

<!-- 采用注释的方式配置bean -->

<context:annotation-config />