diff --git a/pom.xml b/pom.xml
index 5c61eb3..59e31a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -149,6 +149,12 @@
8.1.1.49
+
+ mysql
+ mysql-connector-java
+ runtime
+
+
com.alibaba
druid-spring-boot-starter
diff --git a/src/main/java/com/newyetai/common/util/RequestUtils.java b/src/main/java/com/newyetai/common/util/RequestUtils.java
index 53be174..897b767 100644
--- a/src/main/java/com/newyetai/common/util/RequestUtils.java
+++ b/src/main/java/com/newyetai/common/util/RequestUtils.java
@@ -1,8 +1,11 @@
package com.newyetai.common.util;
+import java.net.Inet4Address;
import java.net.InetAddress;
+import java.net.NetworkInterface;
import java.net.UnknownHostException;
+import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
@@ -168,12 +171,24 @@ public class RequestUtils {
String hostname = System.getenv("HOSTNAME");
String hostIp = InetAddress.getByName(hostname).getHostAddress();
if ("127.0.0.1".equals(hostIp) || "0:0:0:0:0:0:0:1".equals(hostIp)) {
- return InetAddress.getLocalHost().getHostAddress();
+ Enumeration interfaces = NetworkInterface.getNetworkInterfaces();
+ while (interfaces.hasMoreElements()) {
+ NetworkInterface iface = interfaces.nextElement();
+ if (iface.isUp() && !iface.isLoopback()) {
+ Enumeration addresses = iface.getInetAddresses();
+ while (addresses.hasMoreElements()) {
+ InetAddress addr = addresses.nextElement();
+ if (addr instanceof Inet4Address) {
+ return addr.getHostAddress();
+ }
+ }
+ }
+ }
}
return hostIp;
- } catch (UnknownHostException e) {
+ } catch (Exception e) {
+ return "127.0.0.1";
}
- return "127.0.0.1";
}
}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index b282c03..eac68c5 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -2,11 +2,11 @@ spring.application.name=alita-bjy-uygur
spring.profiles.active=uat-uygur
##数据源
-spring.datasource.url=jdbc:dm://139.159.237.199:5236?schema=BJY_UYGUR_JOB&useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false
+spring.datasource.url=jdbc:mysql://121.37.2.171:3306/uygur-job?useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false
#&useAffectedRows=true
-spring.datasource.username=SYSDBA
-spring.datasource.password=SYSDBA001
-spring.datasource.driverClassName=dm.jdbc.driver.DmDriver
+spring.datasource.username=root
+spring.datasource.password=xinshan888
+spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
# 初始化时建立物理连接的个数
@@ -25,7 +25,7 @@ spring.cloud.config.overrideNone=true
# mybatis
mybatis.mapperLocations=classpath*:com/newyetai/**/mapper/*Mapper.xml
mybatis.configuration.map-underscore-to-camel-case=true
-pagehelper.helperDialect=oracle
+pagehelper.helperDialect=mysql
pagehelper.reasonable=true
#mybatis plus
@@ -68,16 +68,6 @@ spring.redis.lettuce.pool.max-active=10
spring.redis.lettuce.pool.max-wait=-1ms
spring.redis.database=13
-##mongodb
-spring.datasource.mongodb.custom.database=alita
-spring.datasource.mongodb.custom.host=121.37.2.171
-spring.datasource.mongodb.custom.port=27017
-spring.datasource.mongodb.custom.username=root
-spring.datasource.mongodb.custom.password=xinshan888
-spring.datasource.mongodb.custom.authentication-database=admin
-spring.datasource.mongodb.custom.connections-per-host=10
-spring.datasource.mongodb.custom.min-connections-per-host=10
-
##mq
spring.rabbitmq.host=121.37.2.171
spring.rabbitmq.port=5672