这个错误是说我的启动失败了。这类问题要从配置文件中开始找原因,我用的是spring框架,所以我从application.中找的原因

Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'dataSource' of bean class [com.liuyang.jdbc.PersonDao]: No property 'dataSource

然后对比路径,对比文件的命名和id,都没有问题,为什么会在启动的时候找不到dataSource,我想到应该是少包,但是,找寻发现包也没有问题。

最后发现是这里错了

Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'dataSource' of bean class [com.liuyang.jdbc.PersonDao]: No property 'dataSource

这里是重点:::!!!!!

     我的getter和setter的方法中设置的dateSource,而配置文件想要注入的是dataSource,两个名称不一致,难怪机器找不到我的文件的class,更改

           

<bean > </bean>

这里所有的dataSource为dateSource,或者更改类中的名称,dateSource为dataSource,连同getter和setter一起才有效。

 

相关文章:

  • 2022-12-23
  • 2021-05-20
  • 2021-06-29
  • 2022-02-24
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
  • 2022-12-23
相关资源
相似解决方案