change mysql

This commit is contained in:
ran.shang
2025-08-06 10:42:34 +08:00
parent 2d43a94f99
commit 2d80d9ac7c
3 changed files with 29 additions and 18 deletions

View File

@@ -149,6 +149,12 @@
<version>8.1.1.49</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>

View File

@@ -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<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
NetworkInterface iface = interfaces.nextElement();
if (iface.isUp() && !iface.isLoopback()) {
Enumeration<InetAddress> 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";
}
}

View File

@@ -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