1.安装MySQL
参考教程:MySQL 8.0下载、安装及配置教程
出现问题:之前安装过MySQL但未删除干净,需要在目录中搜索mysql,将相关文件全部删除,然后再安装
2.安装Redis
参考教程:Windows环境Redis安装配置
安装Redis的可视化程序:Redis Desktop Manager
参考教程:Redis_Desktop_Manager工具使用
3.配置SpringBoot环境
①安装并配置maven
参考教程:Maven简介以及安装教程
②在IDEA中配置SpringBoot环境
参考教程:
出现问题:
①报错:Java: 错误: 无效的源发行版:17
解决方式:[JAVA] java: 错误: 无效的源发行版:17
②报错:java: 无法访问org.springframework.boot.SpringApplication
解决方式:java: 无法访问org.springframework.boot.SpringApplication解决办法
③报错:找不到插件 ‘org.springframework.boot:spring-boot-maven-plugin:‘
解决方式:解决:找不到插件 ‘org.springframework.boot:spring-boot-maven-plugin:‘问题
解决上述问题后,运行代码成功显示出Spring图像
复制教程中的demo进行测试
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@GetMapping("/hello")
public String Hello(){
return "Hello World!";
}
}
出现问题:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-12-19 15:30:53.929 ERROR 26476 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Web server failed to start. Port 6379 was already in use.
Action:
Identify and stop the process that's listening on port 6379 or configure this application to listen on another port.
解决方式:可以描述中是因为6379端口被占用,在application.properties中修改一个空闲的端口8000
参考:Identify and stop the process that’s listening on port 8080 or configure this application to listen
可以看到已经没有报错了
4.安装Postman接口测试工具
官网下载:Postman