苏州外贸网站建设公司,合肥网站建设兼职,以绿色为主的网站,辽宁建设工程信息网联合体怎么报名需求#xff1a;手写一个加密的spring-boot-start#xff0c;按着用户定义的加密算法#xff08;可选#xff1a;MD5、SHA#xff09;去加密内容
新建一个maven项目 新建好的项目结构和pom.xml如图
添加pom.xml
完整的pom.xml文件
?xml version1.0 …需求手写一个加密的spring-boot-start按着用户定义的加密算法可选MD5、SHA去加密内容
新建一个maven项目 新建好的项目结构和pom.xml如图
添加pom.xml
完整的pom.xml文件
?xml version1.0 encodingUTF-8?
project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion2.6.11/versionrelativePath//parentgroupIdcom.cao/groupIdartifactIdmydigest-springboot-starter/artifactIdversion1.0-SNAPSHOT/versionpropertiesmaven.compiler.source8/maven.compiler.sourcemaven.compiler.target8/maven.compiler.target/propertiesdependencies!--包含自动配置的代码--dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-autoconfigure/artifactId/dependency!--非必须编写配置文件时会有提示--dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-configuration-processor/artifactIdoptionaltrue/optional/dependency!--该starter要用到的加密依赖--dependencygroupIdcommons-codec/groupIdartifactIdcommons-codec/artifactIdversion1.15/version/dependency/dependencies/project新加的文件内容标记
新加业务内容
项目的内容在https://gitee.com/cao_wen_bin/my_springboot_starter_digest 如图结构 代码编写完成之后 进行打包并将打包后的包安装到本地maven仓库 查看是否安装成功。
测试
在随便另外的一个项目中引入自己刚刚写的这个依赖
dependencygroupIdcom.cao/groupIdartifactIdmydigest-springboot-starter/artifactIdversion1.0-SNAPSHOT/version
/dependency测试SHA算法加密
在application.yml文件中进行配置
digest:type: sha测试类查看结果
测试MD5算法加密
在application.yml文件中进行配置
digest:type: md5测试类查看结果 以上测试证明自己手写的mydigest-springboot-starter是没有问题的