springboot启动报错A component required a bean of type ‘com.xxx.service.xxxService‘

springboot启动报错A component required a bean of type ‘com.xxx.service.xxxService‘,第1张

springboot启动报错A component required a bean of type ‘com.xxx.service.xxxService’
Description:

A component required a bean of type 'com.zzd.service.UserService' that could not be found.


Action:

Consider defining a bean of type 'com.zzd.service.UserService' in your configuration.

Process finished with exit code 0

看的这条笔记解决的问题

这条错误解决之后 ,又出现了另外数据库的错误

### Error updating database.  Cause: java.sql.SQLException: Field 'user_id' doesn't have a default value
### The error may exist in file [H:\IdeaProjects\FMShop\springboot-demo01\target\classes\mappers\UserNapper.xml]
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: insert into users(user_name,user_pwd,user_realname,user_img)         values(?,?,?,?)
### Cause: java.sql.SQLException: Field 'user_id' doesn't have a default value

左链接查询时用的字段名称和已有的字段名称重复,Navicat里字段重复时会自动区分,mybatis里只能手动修改该字段名称

在设计表时主键id设置为自动递增,就能很简单的解决这个问题

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/991992.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存