springboot启动报错

新建springboot整合aop记录web日志的过程中启动失败

错误如下:

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.

Reason: Failed to determine a suitable driver class

解决方法:

在启动类的@EnableAutoConfiguration或@SpringBootApplication后添加(exclude = {DataSourceAutoConfiguration.class}),排除此类的autoconfig。启动以后就可以正常运行。

这是因为添加了数据库组件,所以autoconfig会去读取数据源配置,而我新建的项目还没有配置数据源,所以会导致异常出现。

 

posted @ 2018-04-10 11:13  不二尘  阅读(1959)  评论(0编辑  收藏  举报