启动后一直报错Cannot determine embedded database driver class for database type NONE
问题原因
产生这个异常发现是 SpringBoot 启动时会自动注入数据源和配置 jpa
解决方法
在启动类加上这个
@SpringBootApplication(exclude=
{DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
隔离了数据源的结果就是疯狂报我无法扫描到注解,在需要数据库的情况下不要这样干
请老老实实建表,我之前忘记了还要连接数据库这回事了orz,建立内嵌h2数据库的配置
server.port=8080
#spring.session.store-type=none
## DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
spring.datasource.url=jdbc:h2:file:~/Desktop/ssdb;DB_CLOSE_ON_EXIT=TRUE;FILE_LOCK=NO
#;AUTO_SERVER=TRUE
#;DB_CLOSE_ON_EXIT=TRUE;FILE_LOCK=NO
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driver-class-name=org.h2.Driver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.database=H2
spring.jpa.show-sql=true
spring.h2.console.enabled=true
spring.datasource.connection-timeout=5000
#open shutdown
endpoints.shutdown.enabled=true