From 8aea3ecc955f5c55024686375bc6b2fc3a989a35 Mon Sep 17 00:00:00 2001 From: zjh <1084500556@qq.com> Date: 星期三, 03 七月 2024 15:44:32 +0800 Subject: [PATCH] zjh 2024/07/3-1 --- ltkj-framework/src/main/java/com/ltkj/framework/config/RedisConfig.java | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ltkj-framework/src/main/java/com/ltkj/framework/config/RedisConfig.java b/ltkj-framework/src/main/java/com/ltkj/framework/config/RedisConfig.java index c2ba0eb..78a3af4 100644 --- a/ltkj-framework/src/main/java/com/ltkj/framework/config/RedisConfig.java +++ b/ltkj-framework/src/main/java/com/ltkj/framework/config/RedisConfig.java @@ -1,6 +1,7 @@ package com.ltkj.framework.config; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.cache.annotation.CachingConfigurerSupport; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; @@ -24,6 +25,12 @@ @EnableCaching @Slf4j public class RedisConfig extends CachingConfigurerSupport { + + @Value ("${config.properties}") + private String url; + + @Value ("${config.path}") + private String path; @Bean @SuppressWarnings(value = {"unchecked", "rawtypes"}) @@ -65,14 +72,14 @@ FileInputStream fis = null; Properties props = new Properties(); try { - fis = new FileInputStream("D:\\ltkjprojectconf\\config.properties"); + fis = new FileInputStream(url); } catch (FileNotFoundException e) { log.info("閰嶇疆鏂囦欢鎵句笉鍒� 绯荤粺姝e湪鍒涘缓锛�"); - File f = new File("D:\\ltkjprojectconf"); + File f = new File(path); if(!f.exists()){ f.mkdirs(); } - File file = new File("D:\\ltkjprojectconf\\config.properties"); + File file = new File(url); try { FileWriter fileWriter = new FileWriter(file); fileWriter.write("ip = 浣犵殑涓绘暟鎹簱杩炴帴ip鍦板潃\n"); -- Gitblit v1.8.0