当前位置: 移动技术网 > 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 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包,重编译,然后就可以正常启动。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网