springboot 项目启动无法加载到 application 文件
今天遇到一个问题,项目启动可以加载到 apollo(配置中心) 中配置的配置文件,但是在自己本地resources目录下新增了一个 application.properties 文件并在里面配置了配置文件么但是不起作用的问题。
经过验证,需要在 pom.xml 文件中配置加载文件。配置如下。
上面标红的配置文件就是指定项目启动需要加载的配置文件,以上标红配置解决了 项目启动无法加载配置文件的问题
明天继续飞 博主文章分类:springboot专题 ©著作权
文章标签 springboot maven 配置文件 xml 文章分类 运维
springboot 项目启动无法加载到 application 文件
今天遇到一个问题,项目启动可以加载到 apollo(配置中心) 中配置的配置文件,但是在自己本地resources目录下新增了一个 application.properties 文件并在里面配置了配置文件么但是不起作用的问题。
经过验证,需要在 pom.xml 文件中配置加载文件。配置如下。
上面标红的配置文件就是指定项目启动需要加载的配置文件,以上标红配置解决了 项目启动无法加载配置文件的问题
Spring Boot的配置文件加载的逻辑是在类ConfigFileApplicationListener来完成的。如果一开始不知道这个类,可以通过一步一步debug或者在项目中通过如下方式查找关键字application.properties.首先打开Find in Path对话框,然后输入application.properties,点击Scope,默认范围是All Places。也可以找到这
【背景】为什么要用 docker 来安装和运行服务应用?相信曾经在各大操作系统上安装过数据库的同学们对于“安装”这一行为都有过深恶痛绝的体会:安装失败、安装的源无效、依赖关系错误、各种配置文件难以配置……在一个应用运行久了以后,还会出现应用产出的文件位置混乱等等一系列问题。如果没有良好的规划,时间一久,我们的操作系统就会混乱到连我们自己也不想去看……不过,好在这一切问题,在 dock
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M