springboot项目中没有识别到yml文件解决办法
•
后端
springboot项目中没有识别到yml文件解决办法
![外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传]
1、这个意思就是没有配置数据库的数据源路径。所以需要配置数据源,比如mysql的驱动和路径。检查是否在properties或者yml文件中是否已经配置好。
2、若未配置好,则配置;
spring:
datasource:
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://47.107.54.146:3306/gulimall_pms?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: root
mybatis-plus:
mapperLocations: classpath:mapper/**/*.xml
global-config:
db-config:
id-type: auto
3、若已配置好,则没加载进去,1)添加springboot和yml插件;2)在pom里面配置build加载文件到项目中
src/main/resources
**/*.properties
**/*.xml
**/*.yml
true
src/main/java
**/*.properties
**/*.xml
**/*.yml
true
解决成功:

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/45e82e5b20.html
