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

ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit 6b14b349f78ad5a5725c686dae7c9baa9c24ccb1
Author: Francesco Chicchiriccò <[email protected]>
AuthorDate: Thu Sep 17 14:15:10 2020 +0200

    Ensure Flowable init works flawlessly
---
 ...uibasePropertySourcesPlaceholderConfigurer.java | 59 ++++++++++++++++++++++
 fit/core-reference/src/main/resources/log4j2.xml   |  4 ++
 2 files changed, 63 insertions(+)

diff --git 
a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/FlowableLiquibasePropertySourcesPlaceholderConfigurer.java
 
b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/FlowableLiquibasePropertySourcesPlaceholderConfigurer.java
new file mode 100644
index 0000000..3699ea3
--- /dev/null
+++ 
b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/FlowableLiquibasePropertySourcesPlaceholderConfigurer.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.flowable;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.context.EnvironmentAware;
+import 
org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.Environment;
+import org.springframework.core.env.MapPropertySource;
+import org.springframework.stereotype.Component;
+
+/**
+ * Needed with Flowable 6.5.0 or higer.
+ *
+ * For more information, check 
https://github.com/flowable/flowable-engine/issues/2142
+ */
+@Component
+public class FlowableLiquibasePropertySourcesPlaceholderConfigurer
+        extends PropertySourcesPlaceholderConfigurer
+        implements EnvironmentAware, InitializingBean {
+
+    private static final String LIQUIBASE_PROPERTY = 
"spring.liquibase.enabled";
+
+    private ConfigurableEnvironment env;
+
+    @Override
+    public void setEnvironment(final Environment env) {
+        this.env = (ConfigurableEnvironment) env;
+        super.setEnvironment(env);
+    }
+
+    @Override
+    public void afterPropertiesSet() throws Exception {
+        if (!env.containsProperty(LIQUIBASE_PROPERTY)) {
+            Map<String, Object> props = new HashMap<>();
+            props.put(LIQUIBASE_PROPERTY, false);
+            env.getPropertySources().addLast(new 
MapPropertySource("flowable-liquibase-override", props));
+        }
+    }
+}
diff --git a/fit/core-reference/src/main/resources/log4j2.xml 
b/fit/core-reference/src/main/resources/log4j2.xml
index 79178a3..7f2dd38 100644
--- a/fit/core-reference/src/main/resources/log4j2.xml
+++ b/fit/core-reference/src/main/resources/log4j2.xml
@@ -144,6 +144,10 @@ under the License.
       <appender-ref ref="mainFile"/>
       <appender-ref ref="main"/>
     </asyncLogger>
+    <asyncLogger name="liquibase" additivity="false" level="ERROR">
+      <appender-ref ref="mainFile"/>
+      <appender-ref ref="main"/>
+    </asyncLogger>
     <asyncLogger name="org.apache.cocoon" additivity="false" level="ERROR">
       <appender-ref ref="mainFile"/>
       <appender-ref ref="main"/>

Reply via email to