SpringBoot单元测试时报错 :java.lang.RuntimeException: Driver com.mysql.jdbc.Driver claims to not accept

SpringBoot启动时报错:

错误代码 : java.lang.RuntimeException: Driver com.mysql.jdbc.Driver claims to not accept
原因排查 : 连接数据库的url配置错误 :

  1. 修改前 :

    spring:
    	datasource:
    		driver-class-name: com.mysql.jdbc.Driver
    	url: mysql://localhost:3306/travel
    	username: root
    	password: root
    
  2. 修改后:

    spring:
    	datasource:
    		driver-class-name: com.mysql.jdbc.Driver
    	url: jdbc:mysql://localhost:3306/travel		# 少复制了 jdbc:
    	username: root
    	password: root
    

你可能感兴趣的:(异常处理)