This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch conf
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/conf by this push:
new 2fb6b6461 [Improve] PropertiesUtils null value improvement
2fb6b6461 is described below
commit 2fb6b646138238a2764d47bd1ed2d7c26abf9699
Author: benjobs <[email protected]>
AuthorDate: Sun Mar 31 10:21:21 2024 +0800
[Improve] PropertiesUtils null value improvement
---
.../streampark/common/util/PropertiesUtils.scala | 14 +++++++-------
.../console/base/config/SpringProperties.java | 22 ++++++++++------------
2 files changed, 17 insertions(+), 19 deletions(-)
diff --git
a/streampark-common/src/main/scala/org/apache/streampark/common/util/PropertiesUtils.scala
b/streampark-common/src/main/scala/org/apache/streampark/common/util/PropertiesUtils.scala
index 35facd89f..03aa13145 100644
---
a/streampark-common/src/main/scala/org/apache/streampark/common/util/PropertiesUtils.scala
+++
b/streampark-common/src/main/scala/org/apache/streampark/common/util/PropertiesUtils.scala
@@ -31,6 +31,7 @@ import scala.collection.JavaConversions._
import scala.collection.JavaConverters._
import scala.collection.mutable
import scala.collection.mutable.{ArrayBuffer, Map => MutableMap}
+import scala.util.Try
object PropertiesUtils extends Logger {
@@ -70,13 +71,12 @@ object PropertiesUtils extends Logger {
})
.toMap
case text =>
- val value = text match {
- case null => ""
- case other => other.toString
- }
- prefix match {
- case "" => proper += k -> value
- case other => proper += s"$other.$k" -> value
+ if (text != null) {
+ val value = text.toString.trim
+ prefix match {
+ case "" => proper += k -> value
+ case other => proper += s"$other.$k" -> value
+ }
}
proper.toMap
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/SpringProperties.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/SpringProperties.java
index 8f53f02eb..2d56f1091 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/SpringProperties.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/SpringProperties.java
@@ -67,8 +67,8 @@ public class SpringProperties {
springConfig.put("spring.datasource.driver-class-name",
"com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e1) {
throw new ExceptionInInitializerError(
- "datasource.dialect is mysql, \"com.mysql.cj.jdbc.Driver\" and
\"com.mysql.jdbc.Driver\" classes not found, please check the MySQL driver
exists in the $streampark/lib,\n"
- + "Notice: The Mysql jdbc driver is incompatible with the
Apache 2.0 license, You need to download the mysql jdbc driver jar and put it
in $streampark/lib.");
+ "datasource.dialect is mysql, \"com.mysql.cj.jdbc.Driver\" and
\"com.mysql.jdbc.Driver\" classes not found, Please ensure that the MySQL
Connector/J can be found under $streampark/lib,\n"
+ + "Notice: The MySQL Connector/J is incompatible with the
Apache 2.0 license, You need to download and put it into $streampark/lib");
}
}
break;
@@ -102,13 +102,11 @@ public class SpringProperties {
userConfig.forEach(
(k, v) -> {
- if (StringUtils.isNoneBlank(k.toString(), v.toString())) {
- String key = configMapping.get(k);
- if (key != null) {
- springConfig.put(key, v);
- } else {
- springConfig.put(k, v);
- }
+ String key = configMapping.get(k);
+ if (key != null) {
+ springConfig.put(key, v);
+ } else {
+ springConfig.put(k, v);
}
});
}
@@ -136,13 +134,13 @@ public class SpringProperties {
private static Properties getSpringConfig() {
Properties config = new Properties();
- // env
+ // basic
+ config.put("spring.application.name", "Apache StreamPark");
+ config.put("spring.main.banner-mode", "false");
config.put("spring.devtools.restart.enabled", "false");
config.put("spring.aop.proxy-target-class", "true");
config.put("spring.messages.encoding", "utf-8");
config.put("spring.main.allow-circular-references", "true");
- config.put("spring.main.banner-mode", "false");
- config.put("spring.application.name", "StreamPark");
config.put("spring.mvc.converters.preferred-json-mapper", "jackson");
// jackson