读取jbdc.properties配置文件读取不到

请求帮我看下,麻烦了。折腾了好久。
我把文件放好了啊,为什么读取不到,数据库的那些包我也导好了

img

img


driverClassName=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/travel?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
characterEncoding=utf-8
username=cc
password=495910871a
initialSize=5
maxActive=10
maxWait=3000
validationQuery=SELECT 1
testWhileIdle=true


 InputStream inputStream = JdbcUtils.class.getClassLoader().getResourceAsStream("jdbc.properties");

是我蠢了,传入的应该是路径,字符串之类的。

第21行,把jdbc.properties替换成 System.getProperty("user.dir") + "/src/jdbc.properties"

加载配置文件,少了双引号

放的地址不对.proerties要放到resource下面,在main里面,和src同级