江苏网站开发建设电话,呼市网页设计培训,建筑企业资质新规定2022,军人可以做网站吗RuoYi项目开发过程 一、登录功能(鉴权模块)1.1 后端部分1.1.1 什么是JWT?1.1.2 什么是Base64?为什么需要它#xff1f;1.1.3 SpringBoot注解解析1.1.4 依赖注入和控制反转1.1.5 什么是Restful?1.1.6 Log4j 2、Logpack、SLF4j日志框架1.1.7 如何将项目打包成指定bytecode字节… RuoYi项目开发过程 一、登录功能(鉴权模块)1.1 后端部分1.1.1 什么是JWT?1.1.2 什么是Base64?为什么需要它1.1.3 SpringBoot注解解析1.1.4 依赖注入和控制反转1.1.5 什么是Restful?1.1.6 Log4j 2、Logpack、SLF4j日志框架1.1.7 如何将项目打包成指定bytecode字节码版本1.1.7.1 方式一(原生)1.1.7.1 方式二(Maven) 1.1.8 依赖包字节码版本不同如何编译至相同版本1.1.7.1 依赖低版本jar包想将项目整体编译至高版本1.1.7.2 依赖高版本jar包想将项目整体编译至低版本 1.2 前端部分 参考视频或文章链接RuoYi-Cloud官方文档《若依框架讲解-微服务版》- bilibili《若依框架讲解-微服务版》课件 — 提取码 8888《JWT及鉴权》— 骄傲的演员 — CSDN
一、登录功能(鉴权模块)
假如我是RuoYi项目的开发者我应该怎么样从无到有的把这个项目搭建起来或者说我要先开发什么功能因为一开始我对这个项目要划分成哪些模块是模糊的所以先从具体的功能入手等有了大量的项目阅历就知道这个项目要如何划分模块如何进行架构了先开发最常用的用户登录功能。我不打算完全照抄RuoYi的代码而是在其基础上做些改动开发自己的功能但模块甚至命名都会参考RuoYi。 验证码部分是在网关内部直接处理的。
1.1 后端部分
1.1.1 什么是JWT? (1) Single Sign On is a feature that widely uses JWT nowadays, because of its small overhead and its ability to be easily used across different domains. (2) In authentication, when the user successfully logs in using their credentials, a JSON Web Token will be returned. Since tokens are credentials, great care must be taken to prevent security issues. In general, you should not keep tokens longer than required. (3) Whenever the user wants to access a protected route or resource, the user agent should send the JWT, typically in the Authorization header using the Bearer schema. 1.The application or client requests authorization to the authorization server. This is performed through one of the different authorization flows. For example, a typical OpenID Connect compliant web application will go through the /oauth/authorize endpoint using the authorization code flow. 2.When the authorization is granted, the authorization server returns an access token to the application. 3.The application uses the access token to access a protected resource (like an API). 参考视频或文章链接JWT - offical website《JWT及鉴权》— 骄傲的演员 — CSDN
1.1.2 什么是Base64?为什么需要它 (1) Base64 allows you to transport binary over protocols or mediums that cannot handle binary data formats and require simple text. 参考视频或文章链接Base64 encoding: What sysadmins need to know — RedHatBase64 — Wiki
1.1.3 SpringBoot注解解析
我以为注解Annoation最重要的作用是提醒编译器或者说提醒JVM虚拟机带上注解Annoation的这些类、方法、变量有哪些地方是要重点检查与注意的。
注解名称作用参考文章RestController结合了Controller and ResponseBody两个注解简化了配置Every request handling method of the controller class automatically serializes return objects into HttpResponse.The Spring Controller and RestController AnnotationsAutowired若不指定注入类名根据变量名自动注入Guide to Spring AutowiredPostMappingRequestBodySpringBootApplicationConfiguration EnableAutoConfiguration ComponentScan18. Using the SpringBootApplication Annotation
1.1.4 依赖注入和控制反转
两个词是一体两面的说法控制反转即将对象的控制权交给Spring容器而以前的传统方式是程序员手工控制。
参考视频或文章链接《控制反转及注入依赖详情「通俗易懂」》
1.1.5 什么是Restful?
一种设计风格使用HTTP 协议传输数据并通过URL来标识资源的位置和状态。 (1) Resource identification through URI. In the REST architectural style, data and functionality are considered resources and are accessed using Uniform Resource Identifiers (URIs), typically links on the Web. (2) Uniform interface. Resources are manipulated using a fixed set of four create, read, update, delete operations: PUT, GET, POST, and DELETE. 参考视频或文章链接What Are RESTful Web Services? —— The Java EE 6 TutorialRESTful Web Services —— GeeksForGeeks《图文详解 RESTful》—— CSDN
1.1.6 Log4j 2、Logpack、SLF4j日志框架
//TODO待文章引用
1.1.7 如何将项目打包成指定bytecode字节码版本
首先要知道在Maven发明以前也是可以打jar包的所以肯定有两种方式方式一是原生的方式这里可以直接利用IDEA更加便利方式二是使用Maven开始。
1.1.7.1 方式一(原生)
原生方式是采用Build Artifacts方式建立jar包(Artifacts Art艺术 ifacts事实 手工物品)如果不会用Build Artifacts构建jar包请搜索其它文章这里要说的是原生方式下怎么指定字节码版本。 Settings - Build, Execution, Deployment - Compiler - Java Compiler - Per-module bytecode version - 指定module的版本 1.1.7.1 方式二(Maven)
source指.java源码文件是按何种Java版本编写的 target指.class字节码文件是以何种字节码版本生成的这个很好理解。 propertiesmaven.compiler.source6/maven.compiler.source !--这里修改后再mvn reload,即影响Project Structure/Modules/Sources--maven.compiler.target6/maven.compiler.targetproject.build.sourceEncodingUTF-8/project.build.sourceEncoding/properties1.1.8 依赖包字节码版本不同如何编译至相同版本
A包是55.0字节码版本B包是52.0字节码版本你想将项目最终编译成52.0在中国这片土地上52.0是最常用的了我想变革的阻力会随着信创产业的推进而降低老守旧有什么意思还是说能够带来稳定收益守旧就可以了不想着怎么去让架构更优运行更稳定更快听说连JDK都要国产化
参考视频或文章链接《JDK 版本和字节码版本对应表》IDEA —— Project language level
有了问题1.1.7的基础如果你有完整项目源码可以重新编译到指定字节码版本这很简单。
1.1.7.1 依赖低版本jar包想将项目整体编译至高版本
假设你现在有一个依赖的jar包是字节码50.0的并且只有jar包你想将项目整体重新编译至52.0如何操作抱歉依赖包完整打好包那刻起就决定了无法重新再编译至其它字节码版本。
1.1.7.2 依赖高版本jar包想将项目整体编译至低版本
假设你现在有一个依赖的jar包是字节码52.0的并且只有jar包你想将项目整体重新编译至50.0如何操作抱歉依赖包完整打好包那刻起就决定了无法重新再编译至其它字节码版本。 1.2 前端部分
//TODO