zjh
2024-07-03 8aea3ecc955f5c55024686375bc6b2fc3a989a35
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("配置文件找不到 系统正在创建!");
                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");