- 
                Notifications
    You must be signed in to change notification settings 
- Fork 41.6k
Closed
Description
Hi,
I'm using spring boot 2.0.4 to config JOOQ DSLContext as it uses JOOQAutoConfiguration class.
My problem is that provided translation to spring dao exceptions doesn't fit well with already created application error handling.
I need a custom ExecuteListener to translate JOOQ exception into application custom exceptions.
I've tried to expose default listener provider as bean:
@Bean
public DefaultExecuteListenerProvider applicationExceptionTranslatorExecuteListenerProvider() {
	return new DefaultExecuteListenerProvider(new ApplicationExceptionTranslator());
}but JOOQ configuration doesn't pick up provider.
While searching around for other issues I've found in #13329 the solution that works.
@Bean
public static BeanPostProcessor jooqConfigurationPostProcessor() {
	return new BeanPostProcessor() {
		@Override
		public Object postProcessBeforeInitialization(Object bean, String beanName)
				throws BeansException {
			return bean;
		}
		@Override
		public Object postProcessAfterInitialization(Object bean, String beanName)
				throws BeansException {
			if (bean instanceof DefaultConfiguration) {
				((DefaultConfiguration) bean).set(new JOOQExceptionTranslator());
			}
			return bean;
		}
	};
}I need to know if this is the right way of doing it or there is some other way to provide ExecuteListenerProvider with custom ExecuteListener?
Why exposing listenere provider as bean doesn't work, what am I missing?
Thanks
Metadata
Metadata
Assignees
Labels
type: enhancementA general enhancementA general enhancement