IDEA中SpringBoot找不到配置文件

IDEA中SpringBoot找不到配置文件

问题描述

Cannot determine embedded database driver class for database type NONE

If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (the profiles “dev” are currently active).

《IDEA中SpringBoot找不到配置文件》

使用工具:

IntelliJ IDEA 2018.2.5

JRE: 1.8.0_152-release-1248-b19 amd64

JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

Windows 10 10.0

问题分析

  • 首先会考虑是否设置了默认的配置文件,查看是否激活profile,若没有,则进入configurations,在Active profiles下面配置你要激活的文件前缀
  • 接下来会考虑resources文件是否标记为Resource Root
  • 若还是有问题则可能会是多模块工作环境的问题,这种我是在执行mvn spring-boot:run -Pdev的时候发现的,[WARNING] The requested profile “dev” could not be activated because it does not exist.

解决问题

  • 若没有激活profile,则激活profile,可以在配置文件中添加,也可以在
    《IDEA中SpringBoot找不到配置文件》
  • 标记resources文件夹为Resource Root
    《IDEA中SpringBoot找不到配置文件》
  • 若是通过maven执行,IDEA中项目为多模块,则可以修改工作环境。

总结

在之前使用eclipse的时候,编译器会自动识别配置文件,不需要像IDEA一样进行标记,我这次报错的主要原因就是未进行resources文件的标记。

    原文作者:Super沙码龙
    原文地址: https://blog.csdn.net/qq_28591897/article/details/90296576
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞