在学习spring boot 的数据库操作的时候,报了一串错误

 报Error creating bean with name 'dataSource' defined in class path resource 报错解决办法

 

对于初学spring boot的我来说,英语水平低,看不懂报错的信息,给我造成了很大的麻烦,花了我一天的时间,经过不懈的努力后终于让我找到了问题所在

spring boot会默认加载org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration类使用了@Configuration注解向spring注入了dataSource bean,因为工程中没有关于dataSource相关的配置信息,当spring创建dataSource bean因缺少相关的信息就会报错

因此我们需要在Application类上面增加注解

@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})

报Error creating bean with name 'dataSource' defined in class path resource 报错解决办法

参考链接:https://blog.csdn.net/q1035331653/article/details/80418026

 

相关文章:

  • 2021-04-02
  • 2021-09-07
  • 2021-11-27
  • 2021-10-27
  • 2021-12-30
  • 2021-12-28
  • 2021-08-29
  • 2021-09-14
猜你喜欢
  • 2022-01-20
  • 2021-06-12
  • 2021-09-23
  • 2021-05-22
  • 2021-06-15
  • 2021-10-18
  • 2022-01-23
  • 2021-10-30
相关资源
相似解决方案