spring-kotlin-coroutine icon indicating copy to clipboard operation
spring-kotlin-coroutine copied to clipboard

Bean post processing with null bean name

Open RLejolivet opened this issue 6 years ago • 1 comments

I am using spring-boot-starter-quartz for my scheduling-related needs, and adding spring-kotlin-coroutine to my projects make all Quartz Job creation fail with the following error:

org.quartz.SchedulerException: Job instantiation failed
	at org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:47) ~[spring-context-support-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.quartz.core.JobRunShell.initialize(JobRunShell.java:127) ~[quartz-2.3.0.jar:na]
	at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:392) [quartz-2.3.0.jar:na]
Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method org.springframework.kotlin.experimental.coroutine.event.CoroutineApplicationEventPublisherAwareBeanPostProcessor.postProcessBeforeInitialization, parameter beanName
	at org.springframework.kotlin.experimental.coroutine.event.CoroutineApplicationEventPublisherAwareBeanPostProcessor.postProcessBeforeInitialization(CoroutineApplicationEventPublisherAwareBeanPostProcessor.kt) ~[spring-kotlin-coroutine-0.3.6.jar:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]

As Job beans are created by Spring+Quartz based on a classname, I do not have the option to name the beans.

Should CoroutineApplicationEventPublisherAwareBeanPostProcessor accept nullable parameters to fix this, or am I missing something?

RLejolivet avatar Sep 23 '18 12:09 RLejolivet

I see no reason why CoroutineApplicationEventPublisherAwareBeanPostProcessor wouldn't allow beanName to be null. I'll fix it in the next release.

konrad-kaminski avatar Sep 24 '18 03:09 konrad-kaminski