问题一
报错:
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
问题三
使用jackson传数据到浏览器过程中遇到406,浏览器看不懂你传送的数据(List对象)
查看问题发现是没有开启mvc的注解驱动
在spring中配置即可
<mvc:annotation-driven></mvc:annotation-driven>-->
问题四
报错信息: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")
问题八
报错
`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中有误
问题九
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的控制台中查看报错