use spring.cloud.task.tablePrefix for DefaultTaskConfigurer
xymondeath opened this issue · 2 comments
I don't know if this is an issue or just a request for an improvement.
I am launching a spring boot3 task with SCDF.
It fails with the following error
org.springframework.context.ApplicationContextException: Failed to start bean 'taskLifecycleListener' at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-6.0.12.jar:6.0.12] at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:357) ~[spring-context-6.0.12.jar:6.0.12] at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na] at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:156) ~[spring-context-6.0.12.jar:6.0.12] at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:124) ~[spring-context-6.0.12.jar:6.0.12] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:958) ~[spring-context-6.0.12.jar:6.0.12] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:611) ~[spring-context-6.0.12.jar:6.0.12] at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66) ~[spring-boot-3.1.4.jar:3.1.4] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) ~[spring-boot-3.1.4.jar:3.1.4] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-3.1.4.jar:3.1.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-3.1.4.jar:3.1.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[spring-boot-3.1.4.jar:3.1.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[spring-boot-3.1.4.jar:3.1.4] at com.xymondeath.executor.Executor.main(Executor.java:17) ~[classes/:na] Caused by: java.lang.IllegalArgumentException: Invalid TaskExecution, ID 100267 not found at org.springframework.util.Assert.notNull(Assert.java:204) ~[spring-core-6.0.12.jar:6.0.12] at org.springframework.cloud.task.listener.TaskLifecycleListener.doTaskStart(TaskLifecycleListener.java:275) ~[spring-cloud-task-core-3.0.3.jar:3.0.3] at org.springframework.cloud.task.listener.TaskLifecycleListener.start(TaskLifecycleListener.java:411) ~[spring-cloud-task-core-3.0.3.jar:3.0.3] at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:179) ~[spring-context-6.0.12.jar:6.0.12] ... 13 common frames omitted 2023-10-24T11:09:22.706674270+02:00
We are using a DefaultTaskConfigurer that injects a datasource.
This issue is that by default he will use the TaskProperties.DEFAULT_TABLE_PREFIX (TASK_)
We are using spring cloud task 3.0.3 and SCDF so he should be using BOOT3_TASK_
SCDF passes along the following: SPRING_CLOUD_TASK_TABLEPREFIX: BOOT3_TASK_
Should the DefaultTaskConfigurer by default not first look at this property and if it isn't present use TaskProperties.DEFAULT_TABLE_PREFIX?
We can add a new constructor for DefaultTaskConfigurer that would accept the following parameters (DataSource, TablePrefix).
After some discussions I don't think that the DefaultConfigurer
should offer this behavior. Rather it is up to the user to set this value at the time they create the instance of the DefaultConfigurer
if they are using configuration other than SimpleTaskAutoConfiguration
. And the current set of constructors support this. If you feel this issue is closed in error please comment.
Thank you for suggesting.