Skip to content

Commit

Permalink
bugfix:fix can not access a member of DruidDataSourceWrapper (apache#…
Browse files Browse the repository at this point in the history
  • Loading branch information
xingfudeshi authored Oct 8, 2019
1 parent eea1405 commit 91559f7
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.cglib.proxy.Enhancer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
Expand All @@ -62,7 +61,7 @@
*/
public class GlobalTransactionScanner extends AbstractAutoProxyCreator
implements InitializingBean, ApplicationContextAware,
DisposableBean, BeanPostProcessor {
DisposableBean {

/**
*
Expand Down Expand Up @@ -317,7 +316,14 @@ public Object postProcessBeforeInitialization(Object bean, String beanName) thro
if (null != m) {
return m.invoke(dataSourceProxy, args);
} else {
return method.invoke(bean, args);
boolean oldAccessible = method.isAccessible();
try {
method.setAccessible(true);
return method.invoke(bean, args);
} finally {
//recover the original accessible for security reason
method.setAccessible(oldAccessible);
}
}
});
}
Expand Down

0 comments on commit 91559f7

Please sign in to comment.