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设置为自动递增,就能很简单的解决这个问题

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐