ITeye博客

前三句可以打印 mybatis log

dannyhz · 2018-03-25 21:46 · spring · mybatis · log4j2 · 企业架构 · Markdown

@Test public void test() throws Exception{ File config=new File("D:/finance/finance-voucher/src/main/resources/conf/finance-voucher-log.xml"); ConfigurationSource source = new ConfigurationSource(new FileInputStream(config),config); Configurator.initialize(null, source);

ApplicationContext act = new ClassPathXmlApplicationContext(new String[] { "conf/beans.xml" }); SharedService sharedService = act.getBean(SharedService.class); Map paramMap = new HashMap(); paramMap.put(VoucherConstants.SHARED_SERVICE, sharedService);

    CountDownLatch cdl =  new CountDownLatch(1);
    CompensatoryRepayRecordDetailProcessor processor = null;
    try {
        Date dt = DateUtils.getDate("2018-03-15", "yyyy-MM-dd");
        paramMap.put(VoucherConstants.QUERY_DATE, dt);
        processor = new CompensatoryRepayRecordDetailProcessor(cdl, paramMap);
        processor.call();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。