1. 錯誤
springboot項目啟動時,如果沒有配置數據庫配置,啟動時會拋出如下異常。
Description:
Cannot determine embedded database driver class for database type NONE
Action:
If you want an embedded database please put a supported one on the classpath.
If you have database settings to be loaded from a particular profile you may
need to active it (no profiles are currently active).
2. 原因
springboot會自動注入數據源,而你卻沒有配,所以他就拋出該異常。
3. 如何不配
如果你只是簡單的想建個項目,並不需要數據庫支持,那么你可以讓他不去注入數據源。
// 一般你啟動springboot項目,都會寫一個有@SpringBootApplication注解的類
// 你在這個注解中添加exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class}
// 即可無數據庫運行
// 如下
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
---------------------
作者:簡簡單單OnlineZuozuo
來源:CSDN
原文:https://blog.csdn.net/qq_15071263/article/details/78458890
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!