public static SqlSession getSqlSession(){
SqlSession openSession=null;
//通过配置文件获取数据库链接信息
try {
Reader resourceAsReader = Resources.getResourceAsReader("com/rui/config/Configuration.xml");
//通过配置文件构建一个SQLSessionFactory
SqlSessionFactory build = new SqlSessionFactoryBuilder().build(resourceAsReader);
//通过SQLSessionFactory打开一个数据库会话
openSession = build.openSession();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return openSession;
}
异常是:
java.lang.IllegalArgumentException: Unmatched braces in the pattern.