springboot集成disconf配置文件下载路径问题
2018-02-02 19:59
447 查看
一、前言
最近因项目需要,准备入手研究百度开源的分布式配置中心disconf,在涉及到配置文件下载路径的时候,发现本地测试的情况跟官网说的不太一样(官网点击打开链接 ),这里做个记录以便及时查看。后面的测试主要是基于springboot的。
二、测试模拟
我使用的disconf版本是目前的最新版2.6.36。在测试之前,先说明几个和路径相关的配置。
targetDirPath:指用户在类上面指定的某个配置文件的下载路径
disconf.enable_local_download_dir_in_class_path:指配置文件下载到根目录下(默认问true)
disconf.user_define_download_dir:指用户自定义的配置文件下载路径
2.1 如果targetDirPath为空,设置了disconf.user_define_download_dir,会下载到所设置的值下面,同时生成一个默认的目录disconf/download(但是这个下面没有文件,我理解的这个是相对于配置文件来说的跟目录)。
2.2 如果targetDirPath为空,不设置disconf.user_define_download_dir,会下载到disconf/download下面(无论disconf.enable_local_download_dir_in_class_path=false或者true)
2.3 如果targetDirPath不为空,且设置了disconf.enable_local_download_dir_in_class_path=true,还是只是在classpath下有一个disconf/download文件夹下面,并没有新生成一个config文件夹。
2.4 如果targetDirPath不为空,且设置了disconf.enable_local_download_dir_in_class_path=false(不设置disconf.user_define_download_dir),在项目根目录下有一个disconf文件夹下面,并没有新生成一个config文件夹(disconf2.6.36版本默认会生成一个disconf/download)
2.5 如果targetDirPath不为空,且设置了disconf.user_define_download_dir=src/main/resources(不设置disconf.enable_local_download_dir_in_class_path),那么会在src/main/resources下有配置文件,同时会生成一个空的disconf/download目录,并没有新生成一个config文件夹。
三、结论
综上测试,发现targetPath设置根本就不起作用,刚刚在github上看到,disconf已经没人维护了,官方给出的群也加不上,估计这个开源项目要被遗弃了。相关文章推荐
- Spring 加载xml配置文件路径问题
- Spring的bean 配置文件路径问题(转载)
- Spring 读取配置文件 及路径问题(转)
- 搭建SSH框架遇到的struts.xml找不到spring定义的bean的错误(配置文件的路径问题)
- 用ClassPathXmlApplicationContext读取Spring配置文件的路径问题
- spring 配置内存溢出监听器、文件上传、ie下载json问题
- 【Struts2文件下载】struts.xml文件中配置action,访问路径问题
- spring配置文件在打包使用时找到不路径问题
- Spring Web 配置文件加载路径问题
- Spring整合Struts2 wel.xml中写spring核心配置文件路径问题,顺便总结下我学习SSH整合的过程
- Spring读取配置文件,地址问题,绝对路径,相对路径
- Spring 读取配置文件 及路径问题
- struts1和spring进行整合的时候struts-config.xml文件的配置顺序问题
- TFS 文件显示 未下载 却无法下载到本地 文件路径版定问题解决
- S2SH学习笔记(1)----Struts2,Hibernate,Spring自定义配置文件路径
- 关于Myclipse中java项目新建Source Folder中配置文件路径的问题
- jar包 配置文件路径问题
- java对【配置文件的读取】与【读配置文件时的路径问题】代码总结
- 加载配置文件时的路径问题
- JAVA相关问题:java读取properties配置文件路径问题