To access fields in an underlying object in java.lang.reflect.Proxy,
especially org.springframework.aop.framework.JdkDynamicAopProxy,
you can use the following code:
DirectFieldAccessor directFieldAccessor = new DirectFieldAccessor(someRepository);
Object h = directFieldAccessor.getPropertyValue("h");
directFieldAccessor = new DirectFieldAccessor(h);
Object advised = directFieldAccessor.getPropertyValue("advised");
directFieldAccessor = new DirectFieldAccessor(advised);
Object targetSource = directFieldAccessor.getPropertyValue("targetSource");
directFieldAccessor = new DirectFieldAccessor(targetSource);
Object target = directFieldAccessor.getPropertyValue("target");
directFieldAccessor = new DirectFieldAccessor(target);
directFieldAccessor.setPropertyValue("sqlSessionSelector", sqlSessionSelector);
No comments:
Post a Comment