1、Cannot determine embedded database driver class for database type NONE
不连接数据库启动项目报上面的错误,是因为springboot启动时会自动注入数据源和配置jpa。
解决方法:pom.xml中加入
<dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> </dependency>
application.properties中加入
spring.datasource.url=jdbc:mysql://xxx.xx.xxx.xxx:3306/xx?useUnicode=true&characterEncoding=UTF-8&useSSL=false
spring.datasource.username = xx
spring.datasource.password = xx
spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.datasource.max-active=20
spring.datasource.max-idle=8
spring.datasource.min-idle=8
spring.datasource.initial-size=10
(https://blog.csdn.net/hengyunabc/article/details/78762097这篇文章中讲的更加详细)
2、springboot SocialConfigurerAdapter.class cannot be opened because it does not exist
原因:启动类不能直接放在java文件夹下。解决方法:加层包结构。
3、java.lang.NoClassDefFoundError: org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvider
springboot1升到2,如果引用了druid-spring-boot-starter
,需要把数据源的版本也升一下。