## 遇到的问题及对应的解决方案 ### 2022.10 #### 2022.10.21 项目创建后启动失败,提示:Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured. ```bash *************************** APPLICATION FAILED TO START *************************** Description: Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured. Reason: Failed to determine a suitable driver class Action: Consider the following: If you want an embedded database (H2, HSQL or Derby), please put it on the classpath. If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active). ``` 解决方案: application.properties 配置文件中添加数据库配置 ```bash # MySQL配置 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://127.0.0.1:3306/epp?useUnicode=true&characterEncoding=utf8&useSSL=false spring.datasource.username=root spring.datasource.password=root ```