---
title: "Ibatis configuration 2"
author: "zerostar88"
date: "2009-06-21T21:43:19Z"
tags: []
slug: "ibatis-configuration-2"
draft: false
lastmod: "2009-06-21T21:43:19Z"
id: 412553
url: "https://jeffyding.iteye.com/blog/412553"
---

now getting SqlMapClient:
SqlAppConfig.java

```java

 /**
 * 
 */
package com.dingfei.config;

import java.io.Reader;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

/**
 * @author Jeffy
 * 
 */
public class SqlAppConfig {
	private static final SqlMapClient sqlMap;
	static {
		try {
			String resource = "conf/SqlMapConfig.xml";
			Reader reader = Resources.getResourceAsReader(resource);
			sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
			reader.close();
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException(
					"Error initializing MyAppSqlConfig class. Cause: " + e);
		}
	}

	public static SqlMapClient getSqlMapInstance() {
		return sqlMap;
	}
}

```