web 应用获取mybatis sqlSessionFactory 扫描保存的的sqlMapper

ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
SqlSessionFactory fact
= (SqlSessionFactory)ctx.getBean("sqlSessionFactory2"); Collection<String> coll = fact.getConfiguration().getMappedStatementNames(); for(String name : coll)   log.info("dao name:" + name);

 

posted @ 2013-11-06 13:34  yiyi_2  阅读(441)  评论(0编辑  收藏  举报