tianboguang před 3 roky
rodič
revize
a9acca969d

+ 0 - 11
pom.xml

@@ -23,11 +23,6 @@
 		</dependency>
 		<dependency>
 			<groupId>com.fdkankan</groupId>
-			<artifactId>4dkankan-center-platform-api</artifactId>
-			<version>2.0.0-SNAPSHOT</version>
-		</dependency>
-		<dependency>
-			<groupId>com.fdkankan</groupId>
 			<artifactId>4dkankan-utils-rubber-sheeting</artifactId>
 			<version>3.0.0-SNAPSHOT</version>
 		</dependency>
@@ -51,12 +46,6 @@
 
 		<dependency>
 			<groupId>com.fdkankan</groupId>
-			<artifactId>4dkankan-utils-mq</artifactId>
-			<version>3.0.0-SNAPSHOT</version>
-		</dependency>
-
-		<dependency>
-			<groupId>com.fdkankan</groupId>
 			<artifactId>4dkankan-utils-rabbitmq</artifactId>
 			<version>3.0.0-SNAPSHOT</version>
 		</dependency>

+ 0 - 2
src/main/java/com/fdkankan/modeling/ModelingApplication.java

@@ -4,14 +4,12 @@ import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
 @SpringBootApplication
 @EnableScheduling
 @EnableDiscoveryClient
-@EnableFeignClients("com.fdkankan.*.api.feign")
 @ComponentScan(basePackages = {"com.fdkankan.*"})
 @MapperScan("com.fdkankan.**.mapper")
 public class ModelingApplication {

+ 36 - 0
src/main/java/com/fdkankan/modeling/config/LogPathHostNameProperty.java

@@ -0,0 +1,36 @@
+package com.fdkankan.modeling.config;
+
+import ch.qos.logback.core.PropertyDefinerBase;
+import com.fdkankan.common.util.FileUtils;
+import org.springframework.util.ObjectUtils;
+
+//@Component
+public class LogPathHostNameProperty extends PropertyDefinerBase {
+
+//    @Value("${hostName.filePath:/opt/hosts/hosts.txt}")
+//    private String hostNamePath;
+
+    @Override
+    public String getPropertyValue() {
+
+        String hostNamePath = getContext().getProperty("hostName.filePath");
+        if(ObjectUtils.isEmpty(hostNamePath)){
+            hostNamePath = "/opt/hosts/hosts.txt";
+        }
+        String hostName = "null";
+        try {
+            hostName = FileUtils.readFile(hostNamePath);
+            // 去除空格
+            if(!ObjectUtils.isEmpty(hostName)){
+                hostName = hostName.trim().replaceAll("\\s","");
+            }
+        } catch (Exception e) {
+            System.err.println("=========================error======================");
+            System.err.println("从文件中获取服务器名称失败,文件路径:"+hostNamePath);
+            return hostName;
+        }
+        return hostName;
+    }
+
+
+}

+ 1 - 1
src/main/resources/bootstrap-test.yml

@@ -6,7 +6,7 @@ spring:
       config:
         server-addr: 120.24.144.164:8848
         file-extension: yaml
-        namespace: 4dkankan-test
+        namespace: 4dkankan-v4
         extension-configs:
           - data-id: 4dkankan-center-modeling.yaml
             group: DEFAULT_GROUP

+ 1 - 1
src/main/resources/logback-spring.xml

@@ -5,7 +5,7 @@
 <!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
 <configuration scan="true" scanPeriod="10 seconds">
 	<springProperty scope="context" name="LOG_PATH" source="logging.path"/>
-	<define name="hostName" class = "com.fdkankan.common.config.LogPathHostNameProperty"/>
+	<define name="hostName" class = "com.fdkankan.modeling.config.LogPathHostNameProperty"/>
 
 	<contextName>logback</contextName>
 	<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->