| | |
| | | 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; |
| | |
| | | @EnableCaching |
| | | @Slf4j |
| | | public class RedisConfig extends CachingConfigurerSupport { |
| | | |
| | | @Value ("${config.properties}") |
| | | private String url; |
| | | |
| | | @Value ("${config.path}") |
| | | private String path; |
| | | |
| | | @Bean |
| | | @SuppressWarnings(value = {"unchecked", "rawtypes"}) |
| | |
| | | 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"); |