目录
问题
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-08-31 10:04:38.194 ERROR 10624 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
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).
解决
数据库找不到合适的url
在application.properties中要写datasource的url、username、password等信息
spring.datasource.url=jdbc:mysql://localhost:3306/test?serverTimeZone&useUnicode=true&characterEncoding=utf-8
spring.datasource.username=root
spring.datasource.password=12345
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
如果端口号出现占用的问题修改端口号
server.port=8081
重新启动问题解决