|
@@ -5,7 +5,6 @@ import org.slf4j.Logger;
|
5
|
5
|
import org.slf4j.LoggerFactory;
|
6
|
6
|
import org.springframework.beans.factory.annotation.Value;
|
7
|
7
|
import org.springframework.context.annotation.Bean;
|
8
|
|
-import org.springframework.context.annotation.ComponentScan;
|
9
|
8
|
import org.springframework.context.annotation.Configuration;
|
10
|
9
|
|
11
|
10
|
/**
|
|
@@ -54,4 +53,22 @@ public class XxlJobConfig {
|
54
|
53
|
return xxlJobSpringExecutor;
|
55
|
54
|
}
|
56
|
55
|
|
|
56
|
+ /**
|
|
57
|
+ * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
|
|
58
|
+ *
|
|
59
|
+ * 1、引入依赖:
|
|
60
|
+ * <dependency>
|
|
61
|
+ * <groupId>org.springframework.cloud</groupId>
|
|
62
|
+ * <artifactId>spring-cloud-commons</artifactId>
|
|
63
|
+ * <version>${version}</version>
|
|
64
|
+ * </dependency>
|
|
65
|
+ *
|
|
66
|
+ * 2、配置文件,或者容器启动变量
|
|
67
|
+ * spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
|
|
68
|
+ *
|
|
69
|
+ * 3、获取IP
|
|
70
|
+ * String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
|
|
71
|
+ */
|
|
72
|
+
|
|
73
|
+
|
57
|
74
|
}
|