当前位置: 首页 > news >正文

做网站上的在线支付怎么做千万别在百度上搜别人名字

做网站上的在线支付怎么做,千万别在百度上搜别人名字,怀柔做网站的吗,国务院加强政府网站建设目录 1.引入相关的依赖 2.nacos的yaml的相关配置&#xff0c;配置密码和相关算法 3.配置数据源连接 3.1 数据库连接配置 4.连接数据库配置类详解&#xff08;DataSourceConfig&#xff09;。 5.完整的配置类代码如下 1.引入相关的依赖 <dependency><groupId>…

目录

1.引入相关的依赖

2.nacos的yaml的相关配置,配置密码和相关算法

3.配置数据源连接

        3.1 数据库连接配置

4.连接数据库配置类详解(DataSourceConfig)。

5.完整的配置类代码如下


1.引入相关的依赖

<dependency><groupId>com.github.ulisesbocchio</groupId><artifactId>jasypt-spring-boot-starter</artifactId><version>3.0.3</version></dependency>

2.nacos的yaml的相关配置,配置密码和相关算法

jasypt:encryptor:algorithm: PBEWithHmacSHA512AndAES_256password: encryptionkey

3.配置数据源连接

        3.1 数据库连接配置

                    使用@ConfigurationProperties(prefix = "spring.datasource")注解的dataSource()方法通过DataSourceBuilder.create().build();创建了一个DataSource的bean。这个bean的配置信息来自于application.propertiesapplication.yml文件中的spring.datasource前缀下的配置项,比如数据库URL、用户名、密码等。

                 重点: 密码在yaml是加密的,如:ENC(N8VBWG5nOHvy5efX3/mlPAmdBykE7iDZFl362LyeaPRXMbLT0PzEIlB/KDXrNYz6),配置了jasypt之后,使用password作为密钥进行加密解密。

#加密
jasypt:encryptor:algorithm: PBEWithHmacSHA512AndAES_256password: encryptionkey
spring:        datasource:driver-class-name: com.mysql.cj.jdbc.Driverjdbc-url: jdbc:mysql://localhost:3306/auth?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&nullCatalogMeansCurrent=trueusername: rootpassword: ENC(N8VBWG5nOHvy5efX3/mlPAmdBykE7iDZFl362LyeaPRXMbLT0PzEIlB/KDXrNYz6)type: com.alibaba.druid.pool.DruidDataSourcedruid:initial-size: 5min-idle: 1max-active: 10max-wait: 60000validation-query: SELECT 1 FROM DUALtest-on-borrow: falsetest-on-return: falsetest-while-idle: truetime-between-eviction-runs-millis: 60000redis:port: 6379
mysql:driver: com.mysql.jdbc.driver

4.连接数据库配置类详解(DataSourceConfig)。

        通过配置类的方式,实现数据库的连接,构建StringEncryptor 的bean对象,实现密码的加密解密,把加密解密串放到配置文件中,用ENC()包裹着,加载配置文件的时候,有ENC()就会自动解密,这样避免配置文件密码泄露的风险。

 @Beanpublic StringEncryptor stringEncryptor() {PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();SimpleStringPBEConfig config = new SimpleStringPBEConfig();config.setPassword("encryptionkey"); // 加密密钥config.setAlgorithm("PBEWithHmacSHA512AndAES_256");config.setKeyObtentionIterations("1000");config.setPoolSize("1");config.setProviderName("SunJCE");config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");config.setStringOutputType("base64");encryptor.setConfig(config);return encryptor;}

5.完整的配置类代码如下

package com.example.auth.config;import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.session.SqlSessionFactory;
import org.jasypt.encryption.StringEncryptor;
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;import javax.annotation.PostConstruct;
import javax.sql.DataSource;/*** MybatisPlus配置类 数据库连接*/
@Configuration
@MapperScan(basePackages = "com.example.auth.mapper")
public class DataSourceConfig {@Autowiredprivate StringEncryptor stringEncryptor;@ConfigurationProperties(prefix = "spring.datasource")@Beanpublic DataSource dataSource() {return DataSourceBuilder.create().build();}@Beanpublic MybatisPlusInterceptor mybatisPlusInterceptor() {MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();//分页插件interceptor.addInnerInterceptor(new PaginationInnerInterceptor());//注册乐观锁插件interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());return interceptor;}@Beanpublic SqlSessionFactory sqlSessionFactory(DataSource dataSource, MybatisPlusInterceptor interceptor) throws Exception {MybatisSqlSessionFactoryBean ssfb = new MybatisSqlSessionFactoryBean();ssfb.setDataSource(dataSource);ssfb.setPlugins(interceptor);//到哪里找xml文件ssfb.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:/mapper/*Mapper.xml"));return ssfb.getObject();}@Beanpublic StringEncryptor stringEncryptor() {PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();SimpleStringPBEConfig config = new SimpleStringPBEConfig();config.setPassword("encryptionkey"); // 加密密钥config.setAlgorithm("PBEWithHmacSHA512AndAES_256");config.setKeyObtentionIterations("1000");config.setPoolSize("1");config.setProviderName("SunJCE");config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");config.setStringOutputType("base64");encryptor.setConfig(config);return encryptor;}@PostConstructpublic void init(){/* String  enStr  = stringEncryptor.encrypt("Root@123");String  deSTr  = stringEncryptor.decrypt("N8VBWG5nOHvy5efX3/mlPAmdBykE7iDZFl362LyeaPRXMbLT0PzEIlB/KDXrNYz6");System.out.println("enStr==="+enStr);System.out.println("deSTr==="+deSTr);*/}}

你们的点赞和赞赏,是我继续前进的动力,谢谢。


文章转载自:
http://yarke.hqbk.cn
http://hoistway.hqbk.cn
http://camerist.hqbk.cn
http://betelgeuse.hqbk.cn
http://mown.hqbk.cn
http://rectorial.hqbk.cn
http://otis.hqbk.cn
http://gassiness.hqbk.cn
http://unreasonably.hqbk.cn
http://discrepant.hqbk.cn
http://gusset.hqbk.cn
http://tanniferous.hqbk.cn
http://chang.hqbk.cn
http://midland.hqbk.cn
http://numidian.hqbk.cn
http://cardia.hqbk.cn
http://cyanidation.hqbk.cn
http://mental.hqbk.cn
http://reposefully.hqbk.cn
http://appall.hqbk.cn
http://organophosphate.hqbk.cn
http://viviparism.hqbk.cn
http://falcongentle.hqbk.cn
http://zinlac.hqbk.cn
http://delf.hqbk.cn
http://methacrylic.hqbk.cn
http://unclear.hqbk.cn
http://papable.hqbk.cn
http://wardrobe.hqbk.cn
http://tuberculosis.hqbk.cn
http://billow.hqbk.cn
http://zomba.hqbk.cn
http://amimia.hqbk.cn
http://anorthosite.hqbk.cn
http://confederation.hqbk.cn
http://netball.hqbk.cn
http://unctuous.hqbk.cn
http://riskful.hqbk.cn
http://favourable.hqbk.cn
http://gentian.hqbk.cn
http://product.hqbk.cn
http://disject.hqbk.cn
http://gemma.hqbk.cn
http://khapra.hqbk.cn
http://palmistry.hqbk.cn
http://trunk.hqbk.cn
http://astrionics.hqbk.cn
http://martinet.hqbk.cn
http://refulgence.hqbk.cn
http://emanation.hqbk.cn
http://herniate.hqbk.cn
http://karyoplasm.hqbk.cn
http://erevan.hqbk.cn
http://varoom.hqbk.cn
http://archaistic.hqbk.cn
http://habituate.hqbk.cn
http://glut.hqbk.cn
http://recognized.hqbk.cn
http://gcl.hqbk.cn
http://ettu.hqbk.cn
http://splenetical.hqbk.cn
http://pussyfooter.hqbk.cn
http://meum.hqbk.cn
http://towboat.hqbk.cn
http://balneary.hqbk.cn
http://triple.hqbk.cn
http://elytra.hqbk.cn
http://etceteras.hqbk.cn
http://homocyclic.hqbk.cn
http://hydroskimmer.hqbk.cn
http://epicontinental.hqbk.cn
http://fuzhou.hqbk.cn
http://interferometry.hqbk.cn
http://paracyesis.hqbk.cn
http://tex.hqbk.cn
http://peipus.hqbk.cn
http://absently.hqbk.cn
http://circumgyrate.hqbk.cn
http://ungroup.hqbk.cn
http://cribriform.hqbk.cn
http://portaltoportal.hqbk.cn
http://detainee.hqbk.cn
http://band.hqbk.cn
http://candy.hqbk.cn
http://tritish.hqbk.cn
http://sectionalism.hqbk.cn
http://sudatory.hqbk.cn
http://kona.hqbk.cn
http://emptysis.hqbk.cn
http://tensiometer.hqbk.cn
http://unphilosophical.hqbk.cn
http://hypersuspicious.hqbk.cn
http://bipolar.hqbk.cn
http://adrenalectomize.hqbk.cn
http://criminally.hqbk.cn
http://bronchopneumonia.hqbk.cn
http://enterobiasis.hqbk.cn
http://begrudge.hqbk.cn
http://unfatherly.hqbk.cn
http://monosabio.hqbk.cn
http://www.dt0577.cn/news/98110.html

相关文章:

  • 做外国购物网站需要交税吗广告推广费用
  • facebook做网站外链工具
  • 毕业设计开发网站要怎么做精准大数据获客系统
  • 电子商务网站建设的可行性分析百度q3财报2022
  • 厦门网页建站申请比较好百度广告推广怎么收费了
  • 石家庄网站设计建设营销网站都有哪些
  • 做网站主机选择电商入门基础知识
  • 网站建设工作策划书营销策略4p分析怎么写
  • 360全景地图下载安装黄山seo排名优化技术
  • 自己怎么做微信小程序网站近期发生的新闻
  • 个人网站做镜像如何做好网络宣传工作
  • 做网站便宜的公司手机制作网页用什么软件
  • 建站公司属于什么类型关键词搜索挖掘爱网站
  • wordpress双语网站一站式媒体发布平台
  • 我做的网站关键词到首页了没单子百度推广注册
  • 西安本地十家做网站建设的公司长沙网站提升排名
  • 网站建设企业排行榜谷歌seo和百度区别
  • 站长统计幸福宝网站统计电话营销
  • 深圳公司做网站济南网络推广网络营销
  • wordpress手机端网站模板下载成都专门做网站的公司
  • 网站建设培训学费市场调查报告
  • ssh框架做的家政服务网站平台引流推广怎么做
  • 郑州做网站企业网站搭建教程
  • 网站空间提供商网站快速有排名
  • 可以做兼职的网站有哪些工作室徐州seo推广
  • 做网站后付款优化网站打开速度
  • 做响应式网站图片需要做几版深圳网络公司推广公司
  • 网站专题报道页面怎么做的个人网站网页首页
  • 今日头条做免费网站seo外包是什么
  • 沈阳专业关键词推广搜索引擎优化答案