运行后报错
maven在引入spring-boot相关的包后,直接运行ApplicationMain函数,提示报错“Error starting ApplicationContext. To display the auto-configuration report re-run your application with ‘debug’ enabled.“ 如下
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
解决方法
在src/resource/application.properties目录下添加(没有则新建):
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost/ll?useUnicode=yes&characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=password
再次运行后如果继续报错“Error creating bean with name ‘dataSource’ defined in class path resource”
Error creating bean with name 'dataSource' defined in class path resource
....
哈哈,检查是不是:
a. spring.datasource.driver-class-name是否拼写正确,driverClassName这个写法是错误的
b. com.mysql.jdbc.Driver 前后是否有空格,有则删掉
搞定,休息。