[BUG-7554] Fix database lose data in standalone (#7620)

* Fix the wrong lifecycle phase of initialization

Co-authored-by: kezhenxu94 <kezhenxu94@apache.org>
This commit is contained in:
wind 2021-12-25 01:05:08 +08:00 committed by GitHub
parent c7d7eec679
commit f450b7ef28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -28,7 +28,7 @@ import java.lang.annotation.Target;
@Documented
public @interface AccessLogAnnotation {
// ignore request args
String[] ignoreRequestArgs() default {};
String[] ignoreRequestArgs() default {"loginUser"};
boolean ignoreRequest() default false;

View File

@ -31,9 +31,12 @@ spring:
- taskDefinition
caffeine:
spec: maximumSize=100,expireAfterWrite=300s,recordStats
sql:
init:
schema-locations: classpath:sql/dolphinscheduler_h2.sql
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:dolphinscheduler;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=true;INIT=runscript from 'classpath:sql/dolphinscheduler_h2.sql'
url: jdbc:h2:mem:dolphinscheduler;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=true
username: sa
password: ""
quartz:

View File

@ -39,6 +39,8 @@ import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
@Component
@ -62,8 +64,8 @@ public class TaskPluginManager {
return Collections.unmodifiableMap(taskChannelMap);
}
@PostConstruct
public void installPlugin() {
@EventListener
public void installPlugin(ApplicationReadyEvent readyEvent) {
final Set<String> names = new HashSet<>();
ServiceLoader.load(TaskChannelFactory.class).forEach(factory -> {