This is an automated email from the ASF dual-hosted git repository.

caishunfeng pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 3a9e67325e Fix database initialize late in standalone. (#10296)
3a9e67325e is described below

commit 3a9e67325e07e854c2ac796995891ee3b8b192b1
Author: Wenjun Ruan <[email protected]>
AuthorDate: Tue May 31 11:52:00 2022 +0800

    Fix database initialize late in standalone. (#10296)
---
 .../dolphinscheduler/dao/datasource/SpringConnectionFactory.java | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git 
a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/SpringConnectionFactory.java
 
b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/SpringConnectionFactory.java
index d477972ff1..74ca570fb1 100644
--- 
a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/SpringConnectionFactory.java
+++ 
b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/SpringConnectionFactory.java
@@ -24,8 +24,11 @@ import org.apache.ibatis.type.JdbcType;
 
 import java.util.Properties;
 
+import javax.annotation.Resource;
 import javax.sql.DataSource;
 
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
@@ -41,6 +44,12 @@ import 
com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
 @Configuration
 public class SpringConnectionFactory {
 
+    /**
+     * Inject this field to make sure the database is initialized, this can 
solve the table not found issue #8432.
+     */
+    @Autowired(required = false)
+    public DataSourceScriptDatabaseInitializer 
dataSourceScriptDatabaseInitializer;
+
     @Bean
     public PaginationInterceptor paginationInterceptor() {
         return new PaginationInterceptor();

Reply via email to