From 1fd64b07ddb99c2d9cc8a358b71aceb6a2c81492 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期三, 05 七月 2023 15:58:31 +0800
Subject: [PATCH] 修改nettyTCP客户端断开重连 增加数据库连接池 修改日志打印
---
src/main/java/com/ard/utils/SpringTool.java | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/ard/utils/SpringTool.java b/src/main/java/com/ard/utils/SpringTool.java
index 0a7acfb..123317b 100644
--- a/src/main/java/com/ard/utils/SpringTool.java
+++ b/src/main/java/com/ard/utils/SpringTool.java
@@ -1,11 +1,15 @@
package com.ard.utils;
import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
import org.springframework.stereotype.Component;
import java.nio.ByteBuffer;
+import java.util.Properties;
/**
* @Description:
@@ -36,4 +40,18 @@
return getApplicationContext().getBean(name);
}
+ /*yml閰嶇疆淇℃伅鑾峰彇*/
+ public static String getYmlInfo(String key) {
+ Resource resource = new ClassPathResource("application.yml");
+ Properties properties = null;
+ try {
+ YamlPropertiesFactoryBean yamlFactory = new YamlPropertiesFactoryBean();
+ yamlFactory.setResources(resource);
+ properties = yamlFactory.getObject();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ return properties.get(key).toString();
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3