项目中遇到的问题及解决

问题一

报错:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.lanou.mapper.GoodsMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}


Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.lanou.mapper.GoodsMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

**原因:**没导入mapper.xml

问题二

**报错:**404进入方法失败

**原因:**在Controller中没有注解@ResponseBody

问题三

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-dNcFy2ll-1658541859925)(C:\Users\pon18\AppData\Roaming\Typora\typora-user-images\image-20220722162034643.png)]

使用jackson传数据到浏览器过程中遇到406,浏览器看不懂你传送的数据(List对象)

查看问题发现是没有开启mvc的注解驱动

在spring中配置即可

<mvc:annotation-driven></mvc:annotation-driven>-->

问题四

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OVHHIawb-1658541859926)(C:\Users\pon18\AppData\Roaming\Typora\typora-user-images\image-20220722162016972.png)]

报错信息:Uncaught ReferenceError: $ is not defined

原因是我写的:

<script src="js.jquery.js"></script>

正确应该是:

<script src="js/jquery.js"></script>

问题五

在浏览器执行查询操作的时候,在地址栏输入username和password之后始终得不到正确的结果。User的属性名是userName,在输入栏输入后,userName自动变username

因为可能它走了缓存,所以变n

此时在其他文本中复制粘贴修改为userName再重新输入即可

http://localhost:8080/shoppingCart2_war/user/login.do?userName=liguocheng&password=12345

问题六

在html中导入BootStrap框架,但是始终无法在页面显示出来样式,清理缓存target,重新运行。

问题七

控制台出现错误:

Field userMapper in com.lanou.springboot.service.UserService required a bean of type  com.lanou.springboot.mapper.UserMapper  that could not be found.

在启动类上添加@MapperScan("com.lanou.springboot.mapper")

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4scLM24e-1658541888620)(C:\Users\pon18\AppData\Roaming\Typora\typora-user-images\image-20220723093643655.png)]

问题八

报错

`Optional int parameter 'id' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.`

解决
①Mapper层写的@param,在mapper.xml文件中获取时写错了。只有当param为对象时,才会点它的属性

在这里插入图片描述
在这里插入图片描述

②前端页面写的ajax请求data中有误

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-t2ooHnUT-1659060944983)(C:\Users\pon18\AppData\Roaming\Typora\typora-user-images\image-20220728220213183.png)]

在这里插入图片描述

问题九

Description:

Field mapper in com.lanou.jwtauth.service.impl.UserService required a bean of type 'com.lanou.jwtauth.mapper.UserMapper' that could not be found.

The injection point has the following annotations:
	- @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'com.lanou.jwtauth.mapper.UserMapper' in your configuration.

在启动类上添加注解@MapperScan("com.lanou.jwtauth.mapper")

问题十

页面报500

front报错信息如下:

feign.FeignException$InternalServerError: [500] during [POST] to [http://jwtauth/user/login.do] [AuthClient#login(UserToken)]: [{"timestamp":"2022-08-02T12:47:51.077+00:00","status":500,"error":"Internal Server Error","message":"","path":"/user/login.do"}]
	at feign.FeignException.serverErrorStatus(FeignException.java:231) ~[feign-core-10.10.1.jar:na]
......

说明问题在auth,应在auth的控制台中查看报错

aliyun

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值