0
私は情報mybatisマッパープロキシでsqlSessionインスタンスを取得する方法は?
下になったデバッグは、私はSQLSESSIONインスタンスを取得したいとき、私はmybatis mapper
public interface FooMapper {
@Select("select now()")
String getTime();
}
を持っています。だから私はsqlSessionを取得するためにリフレクション方式を試してみました。
Field hField = fooMapper.getClass().getDeclaredField("h");
MapperProxy mapperProxy = (MapperProxy) hField.get(fooMapper);
Field sqlSessionField = mapperProxy.getClass().getDeclaredField("sqlSession");
SqlSession sqlSession = (SqlSession) sqlSessionField.get(mapperProxy);
が、実際に私は(反射が不可能な場合)、反射的またはその他の方法によりfooMapperでSQLSESSIONインスタンスを取得するには、どのようにエラー
java.lang.NoSuch FieldException: h
at java.lang.Class.getDeclaredField(Class.java:2070)
の下にあるの?