SpringでS2Daoを使う -その2-
動かないのは、S2Daoで実装クラス(Employee2DaoImpl)にS2DaoInterceptorをかけた場合です。getEmployeesが見つからないとMethodNotFoundRuntimeExceptionが発生してしまっています。AbstractBeanAutoRegister.registerで下記のコードでクラス生成後、Springに登録しているのですがこの辺が駄目なようですが、色々試してみたもののどうしたら良いかわかりませんでした。
Class targetClass = ClassUtil.forName(className); AspectWeaver weaver = new AspectWeaver(targetClass, null); Method[] methods = targetClass.getDeclaredMethods(); for (int i = 0; i < methods.length; ++i) { weaver.setInterceptors(methods[i], new MethodInterceptor[0]); } Class enhancedClass = weaver.generateClass();
あとは、S2のバージョンを2.4.xにしたら(2.3.xではOK)、JTA関連の実装が変わったのかS2のTransactionManagerImplをSpringのJtaTransactionManagerのpropertyに設定するとTypeMismatchExceptionが発生しました。