当前位置: 萬仟网 > IT编程>开发语言>Java > springboot启动报错Failed to configure a DataSource: 'url' attribute is not specified

springboot启动报错Failed to configure a DataSource: 'url' attribute is not specified

2018年10月29日  | 萬仟网IT编程  | 我要评论
Description: Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. Reason: Failed to dete ...

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

原因: 配置的注解需要连接数据库,一个解决方式是添加exclude排除,代码如下:

@springbootapplication(exclude = datasourceautoconfiguration.class)
我的是一个parent有多个子模块,子模块有两个app且都加了@springbootapplication注解,如果要正常运行两个类必须都加上exclude = datasourceautoconfiguration.class才可以

 经测试,我的是需要去掉依赖


 <dependency>
      <groupid>org.springframework.boot</groupid>
      <artifactid>spring-boot-starter-data-jpa</artifactid>
 </dependency>
手动删除它所生成的项目的jar包,重编译,然后就可以正常启动。

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
Copyright © 2017-2020  萬仟网 保留所有权利. 粤ICP备17035492号-1