在idea上springboot创建项目时,application.properties里jdbc报红

424 阅读1分钟

代码如下:

spring.datasource.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8
spring.datasource.username=hony
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver[这里报红]
#页面热加载
spring.thymeleaf.cache = false
#端口
server.port=8888
#扫描所有mapper,mapper就不用写注解了
mybatis.mapperLocations = classpath*:mapper/*Mapper.xml
#扫描所有实体类就不用写注解了
mybatis.typeAliasesPackage = com.cn.entity
#把——还有变成驼峰,分页插件
mybatis.configLocation = classpath:/static/mybatis-config.xml

解决方法: 在pom.xml中找到mysql的依赖,并且把runtime这行注释掉