Skip to content

Commit

Permalink
Wrap the datasource in postProcessBeforeInitialization instead of pos…
Browse files Browse the repository at this point in the history
…tProcessAfterInitialization
  • Loading branch information
candrews committed Jul 27, 2017
1 parent 47b8fe2 commit bfa8bf9
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -67,11 +67,6 @@ public class Log4jdbcBeanPostProcessor implements BeanPostProcessor {

@Override
public Object postProcessBeforeInitialization(final Object bean, final String beanName) throws BeansException {
return bean;
}

@Override
public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException {
if (bean instanceof DataSource) {
return new DataSourceSpy((DataSource) bean);
}
Expand All @@ -80,6 +75,11 @@ public Object postProcessAfterInitialization(final Object bean, final String bea
}
}

@Override
public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException {
return bean;
}

@PostConstruct
public void postConstruct() {
// Log4jdbc only reads configuration from system properties, so copy relevant environment property to system properties
Expand Down

0 comments on commit bfa8bf9

Please sign in to comment.