问答详情
源自:2-1 SpringBoot的搭建与启动上

不知道怎么解决 这个问题

https://img3.mukewang.com/5b56e9ff00010a1e13660768.jpg java.lang.Object.wait(Native Method)

 java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)

 com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)

2018-07-24 15:58:43.126  INFO 7888 --- [           main] ConditionEvaluationReportLoggingListener : 


Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2018-07-24 15:58:43.151 ERROR 7888 --- [           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).



Process finished with exit code 1


提问者:慕粉2228388982 2018-07-24 16:03

个回答

  • 独孤绝尘
    2018-09-12 16:47:27

    还有一个就是如果你是按照视频敲的代码,开始勾选了mybatis,而你在pom.xml里没有注释掉,就用上边的那个方法配置数据库。但是如果你没有注释掉pom.xml里面的mybatis,注释掉之后新建hello类,就可以运行了


  • 独孤绝尘
    2018-09-12 16:19:34

    配置src\main\resources\application.properties

    spring.datasource.url=jdbc:mysql\://192.168.0.20\:1504/f_me?setUnicode=true&characterEncoding=utf8
    spring.datasource.username=******
    spring.datasource.password=******


  • 独孤绝尘
    2018-09-12 15:23:52

    我也是这个问题,用了楼上的方法还是没用

  • 慕运维5553486
    2018-07-24 19:47:16

    因为还没有配置数据源
    在@SpringBootApplication 注解后 添加 exclude = DataSourceAutoConfiguration.class 再运行