记录遇到的问题及对应的解决方案
This commit is contained in:
		
							
								
								
									
										36
									
								
								Solutions.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Solutions.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
				
			|||||||
 | 
					## 遇到的问题及对应的解决方案
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 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
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -25,11 +25,6 @@
 | 
				
			|||||||
            <version>2.7.4</version>
 | 
					            <version>2.7.4</version>
 | 
				
			||||||
			<scope>test</scope>
 | 
								<scope>test</scope>
 | 
				
			||||||
		</dependency>
 | 
							</dependency>
 | 
				
			||||||
        <dependency>
 | 
					 | 
				
			||||||
            <groupId>org.springframework.boot</groupId>
 | 
					 | 
				
			||||||
            <artifactId>spring-boot-starter-data-jdbc</artifactId>
 | 
					 | 
				
			||||||
            <version>2.7.4</version>
 | 
					 | 
				
			||||||
        </dependency>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- Database -->
 | 
					        <!-- Database -->
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user