| | |
| | | import com.ltkj.system.service.ISysConfigService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| | |
| | | @Slf4j |
| | | public class DruidConfig { |
| | | |
| | | @Value ("${config.properties}") |
| | | private String url; |
| | | |
| | | @Value ("${config.path}") |
| | | private String path; |
| | | |
| | | |
| | | @Bean |
| | | // @ConfigurationProperties("spring.datasource.druid.master") |
| | | public DataSource masterDataSource(DruidProperties druidProperties) { |
| | |
| | | // 从文件中读取配置信息 |
| | | FileInputStream fis = null; |
| | | 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"); |
| | |
| | | // 从文件中读取配置信息 |
| | | FileInputStream fis = null; |
| | | try { |
| | | fis = new FileInputStream("D:\\ltkjprojectconf\\config.properties"); |
| | | fis = new FileInputStream(url); |
| | | } catch (FileNotFoundException e) { |
| | | log.info("数据库连接文件找不到!"); |
| | | } |
| | |
| | | // 从文件中读取配置信息 |
| | | FileInputStream fis = null; |
| | | try { |
| | | fis = new FileInputStream("D:\\ltkjprojectconf\\config.properties"); |
| | | fis = new FileInputStream(url); |
| | | } catch (FileNotFoundException e) { |
| | | log.info("数据库连接文件找不到!"); |
| | | } |
| | |
| | | // 从文件中读取配置信息 |
| | | FileInputStream fis = null; |
| | | try { |
| | | fis = new FileInputStream("D:\\ltkjprojectconf\\config.properties"); |
| | | fis = new FileInputStream(url); |
| | | } catch (FileNotFoundException e) { |
| | | log.info("数据库连接文件找不到"); |
| | | } |