用户中心-上
用户中心-上
用户中心-上
笔记
计划
初始化项目
a. 前端初始化
i. 初始化项目
ii. 引入一些组件之类的
iii. 框架介绍 / 瘦身
b.后端初始化
i. 准备环境(MySQL之类的)验证MySQL是否安装成功 - 连接一下
ii. 初始化后端项目,引入框架(整合框架)
实操
用户中心上 — 分享版 - 飞书云文档
问题汇总
前端
01. 安装yarn?
Yarn是facebook发布的一款取代npm的包管理工具,支持并行下载,速度快。
npm install -g yarn
npm uninstall yarn -g //yarn卸载
02. 管理node版本,此项目node版本为16.14.0
下载nvm(https://github.com/coreybutler/nvm-windows/releases)
windows系统下载nvm-setup.zip安装包
使用nvm可以管理node版本并切换
nvm off // 禁用node.js版本管理(不卸载任何东西)
nvm on // 启用node.js版本管理
nvm install <version> // 安装node.js的命名 version是版本号 例如:nvm install 8.12.0
nvm uninstall <version> // 卸载node.js是的命令,卸载指定版本的nodejs,当安装失败时卸载使用
nvm ls // 显示所有安装的node.js版本
nvm list available // 显示可以安装的所有node.js的版本
nvm use <version> // 切换到使用指定的nodejs版本
nvm v // 显示nvm版本
nvm install stable // 安装最新稳定版
03. FetchError: request to https://registry.npm.taobao.org/ failed, reason: certificate has expired
node_modules
下面的这个包:getnpmregistry
const registryMap = {
taobao: "https://registry.npm.taobao.org",
npm: "https://registry.npmjs.org"
};
把taobao
源 和npm
源 改成https://registry.npmmirror.com/
就可以了
04. Module build failed: Error: ENOENT: no such file or directory, open ‘D:\development\Project\实战\实战类\UserCenter\myapp\node_modules\react-router\esm\react-router.js’
没有这个node包
npm rebuild react-router
需要重新安装umi-ui插件
后端
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userMapper’ defined in file
@Autowired
是Spring
的注解,是按照类型注入,提示找不到对他的bean,因为你没有显示的将userMapper注入到Spring容器中去管理,只需要在UserMapper.java接口上添加@Repository
注解即可,此注解是Spring的注解,将当前类注册到Spring容器中实例化为一个bean
直接将@Autowired
换成@Resource
注解,按照名称注入,此注解是JDK中的注解,不会向@Autowired
那样去Spring容器中寻找bean。
@Mapper注解,此注解是Mybatis中的注解,只是标注此类是一个Mapper。你可以在每一个Mapper接口了上使用此注解,或者在启动类上使用@MapperScan注解直接扫描整个或多个包,效果是一样的,二者选其一即可。并且这两个注解跟上面的注解没有任何关系,并不是注入之类的作用。
An attempt was made to call a method that does not exist. The attempt was made from the following location
.baomidou.mybatisplus.core.MybatisMapperAnnotationBuilder.parse(MybatisMapperAnnotationBuilder.java)mybatis-plus 和 mybatis 版本兼容问题,导致找不到方法
Spring Boot 版本 | MyBatis 版本 | MyBatis-Plus 版本 | MyBatis-Plus Starter 版本 |
---|---|---|---|
2.7.x | 2.2.x | 3.4.x | 3.4.x |
3.0.x | 3.5.x | 3.5.x | 3.5.x |
3.1.x | 3.5.x | 3.5.x | 3.5.x |
3.2.x | 3.5.x | 3.5.x | 3.5.x |
java.lang.NullPointerException at com.lcz.usercenter.SampleTest.testSelect(SampleTest.java
)test目录应该与main目录 结构对应,测试类才能找到启动类
或者显示指定启动类:@RunWith(SpringRunner.class)
@SpringBootTest
@RunWith(SpringRunner.class)
public class SampleTest {
}
再或者使用springboot自带的jupiter的@Test注解
@Test
public void testSelect() {
}