当前位置: 首页 > news >正文 广州做英文网站的公司湖南人文科技学院在哪 news 2025/10/26 2:43:17 广州做英文网站的公司,湖南人文科技学院在哪,网页界面设计中主要包括哪三个方面,学校网站建设制度MP官方文档提供有多数据源配置方案#xff0c;这里没有使用其方案#xff0c;原因是项目不想引入过多依赖 提供一下官网的文档供各位选择多数据源支持 | MyBatis-Plus (baomidou.com) 配置文件 application.properties文件配置两个数据源信息#xff0c;yaml文件自行修改…MP官方文档提供有多数据源配置方案这里没有使用其方案原因是项目不想引入过多依赖 提供一下官网的文档供各位选择多数据源支持 | MyBatis-Plus (baomidou.com) 配置文件 application.properties文件配置两个数据源信息yaml文件自行修改格式 # db1 database spring.datasource.db1.driver-class-namecom.mysql.cj.jdbc.Driver spring.datasource.db1.typecom.zaxxer.hikari.HikariDataSource spring.datasource.db1.urljdbc:mysql://127.0.0.1:3306/db1?useUnicodetruecharacterEncodingutf-8serverTimezoneAsia/ShanghaiuseSSLfalserewriteBatchedStatementstrue spring.datasource.db1.usernameroot spring.datasource.db1.password123456 spring.datasource.db1.hikari.pool-namedb1 spring.datasource.db1.hikari.auto-committrue spring.datasource.db1.hikari.connection-timeout30000 spring.datasource.db1.hikari.idle-timeout600000 spring.datasource.db1.hikari.max-lifetime1800000 spring.datasource.db1.hikari.maximum-pool-size10 spring.datasource.db1.hikari.leak-detection-threshold30000# db2 database spring.datasource.db2.driver-class-namecom.mysql.cj.jdbc.Driver spring.datasource.db2.typecom.zaxxer.hikari.HikariDataSource spring.datasource.db2.urljdbc:mysql://127.0.0.1:3306/db2?useUnicodetruecharacterEncodingutf-8serverTimezoneAsia/ShanghaiuseSSLfalserewriteBatchedStatementstrue spring.datasource.db2.usernameroot spring.datasource.db2.password123456 spring.datasource.db2.hikari.pool-namedb2 spring.datasource.db2.hikari.auto-committrue spring.datasource.db2.hikari.connection-timeout30000 spring.datasource.db2.hikari.idle-timeout600000 spring.datasource.db2.hikari.max-lifetime1800000 spring.datasource.db2.hikari.maximum-pool-size10 spring.datasource.db2.hikari.leak-detection-threshold30000 创建DataSourceConfig类 我这里两个数据源写在一个文件里面也可以拆分成两个。 注意mapper接口和xml的目录不同的数据源在不同的包里面 因为整合的mybatis-plus所以这里的SqlSessionFactory 为 MyBatis-Plus 的 SqlSessionFactory com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean Configuration MapperScan(basePackages {com.xxx.mapper.db1}, sqlSessionFactoryRef db1SqlSessionFactory) MapperScan(basePackages {com.xxx.mapper.db2}, sqlSessionFactoryRef db2SqlSessionFactory) public class DataSourceConfig {/*** db1数据源配置* return*/Bean(name db1DataSourceProperties)PrimaryConfigurationProperties(spring.datasource.db1)public DataSourceProperties db1DataSourceProperties() {return new DataSourceProperties();}PrimaryBean(name db1DataSource)Qualifier(db1DataSource)ConfigurationProperties(prefix spring.datasource.db1.hikari)public HikariDataSource db1DataSource() {return db1DataSourceProperties().initializeDataSourceBuilder().type(HikariDataSource.class).build();}PrimaryBean(db1DataSourceTransactionManager)public DataSourceTransactionManager db1DataSourceTransactionManager(Qualifier(db1DataSource) DataSource dataSource) {return new DataSourceTransactionManager(dataSource);}PrimaryBean(db1SqlSessionFactory)public SqlSessionFactory db1SqlSessionFactory(Qualifier(db1DataSource) DataSource dataSource) throws Exception {MybatisSqlSessionFactoryBean sqlSessionFactory new MybatisSqlSessionFactoryBean();sqlSessionFactory.setDataSource(dataSource);Resource[] resources new PathMatchingResourcePatternResolver().getResources(classpath:mapper/db1/*.xml);sqlSessionFactory.setMapperLocations(resources);// 插件对象MybatisPlusInterceptor mybatisPlusInterceptor new MybatisPlusInterceptor();//分页插件mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));sqlSessionFactory.setPlugins(mybatisPlusInterceptor);return sqlSessionFactory.getObject();}/*** db2数据源配置* return*/Bean(name db2DataSourceProperties)ConfigurationProperties(spring.datasource.db2)public DataSourceProperties db2DataSourceProperties() {return new DataSourceProperties();}Bean(name db2DataSource)Qualifier(db2DataSource)ConfigurationProperties(prefixspring.datasource.db2.hikari)public DataSource db2DataSource() {return db2DataSourceProperties().initializeDataSourceBuilder().type(HikariDataSource.class).build();}Bean(db2DataSourceTransactionManager)public DataSourceTransactionManager db2DataSourceTransactionManager(Qualifier(db2DataSource) DataSource dataSource) {return new DataSourceTransactionManager(dataSource);}Bean(db2SqlSessionFactory)public SqlSessionFactory db2SqlSessionFactory(Qualifier(db2DataSource) DataSource dataSource) throws Exception {MybatisSqlSessionFactoryBean sqlSessionFactory new MybatisSqlSessionFactoryBean();sqlSessionFactory.setDataSource(dataSource);Resource[] resources new PathMatchingResourcePatternResolver().getResources(classpath:mapper/db2/*.xml);sqlSessionFactory.setMapperLocations(resources);// 插件对象MybatisPlusInterceptor mybatisPlusInterceptor new MybatisPlusInterceptor();//分页插件mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));sqlSessionFactory.setPlugins(mybatisPlusInterceptor);return sqlSessionFactory.getObject();} } 参考链接 Spring Boot 2.7.5 HikariCP 连接池多数据源配置_hikari多数据源配置-CSDN博客 Spring Boot Reference Documentation 文章转载自: http://www.morning.zcyxq.cn.gov.cn.zcyxq.cn http://www.morning.qhvah.cn.gov.cn.qhvah.cn http://www.morning.fblkr.cn.gov.cn.fblkr.cn http://www.morning.nndbz.cn.gov.cn.nndbz.cn http://www.morning.fpbj.cn.gov.cn.fpbj.cn http://www.morning.mnkhk.cn.gov.cn.mnkhk.cn http://www.morning.rwdbz.cn.gov.cn.rwdbz.cn http://www.morning.ztdlp.cn.gov.cn.ztdlp.cn http://www.morning.nmngq.cn.gov.cn.nmngq.cn http://www.morning.tknqr.cn.gov.cn.tknqr.cn http://www.morning.mbbgk.com.gov.cn.mbbgk.com http://www.morning.nnwpz.cn.gov.cn.nnwpz.cn http://www.morning.hrypl.cn.gov.cn.hrypl.cn http://www.morning.kfwqd.cn.gov.cn.kfwqd.cn http://www.morning.glxmf.cn.gov.cn.glxmf.cn http://www.morning.rknsp.cn.gov.cn.rknsp.cn http://www.morning.wfkbk.cn.gov.cn.wfkbk.cn http://www.morning.cfnsn.cn.gov.cn.cfnsn.cn http://www.morning.wwjft.cn.gov.cn.wwjft.cn http://www.morning.cttgj.cn.gov.cn.cttgj.cn http://www.morning.ggrzk.cn.gov.cn.ggrzk.cn http://www.morning.ygrdb.cn.gov.cn.ygrdb.cn http://www.morning.mwjwy.cn.gov.cn.mwjwy.cn http://www.morning.mprky.cn.gov.cn.mprky.cn http://www.morning.xznrk.cn.gov.cn.xznrk.cn http://www.morning.zhishizf.cn.gov.cn.zhishizf.cn http://www.morning.taojava.cn.gov.cn.taojava.cn http://www.morning.pzlcd.cn.gov.cn.pzlcd.cn http://www.morning.irqlul.cn.gov.cn.irqlul.cn http://www.morning.xqtqm.cn.gov.cn.xqtqm.cn http://www.morning.kxrld.cn.gov.cn.kxrld.cn http://www.morning.kzhxy.cn.gov.cn.kzhxy.cn http://www.morning.dmldp.cn.gov.cn.dmldp.cn http://www.morning.bhbxd.cn.gov.cn.bhbxd.cn http://www.morning.dqdss.cn.gov.cn.dqdss.cn http://www.morning.dzgyr.cn.gov.cn.dzgyr.cn http://www.morning.wmrgp.cn.gov.cn.wmrgp.cn http://www.morning.xzkgp.cn.gov.cn.xzkgp.cn http://www.morning.ltywr.cn.gov.cn.ltywr.cn http://www.morning.rzbcz.cn.gov.cn.rzbcz.cn http://www.morning.zqwqy.cn.gov.cn.zqwqy.cn http://www.morning.rwdbz.cn.gov.cn.rwdbz.cn http://www.morning.qdrhf.cn.gov.cn.qdrhf.cn http://www.morning.tbknh.cn.gov.cn.tbknh.cn http://www.morning.btwlp.cn.gov.cn.btwlp.cn http://www.morning.hbhnh.cn.gov.cn.hbhnh.cn http://www.morning.spnky.cn.gov.cn.spnky.cn http://www.morning.fpbj.cn.gov.cn.fpbj.cn http://www.morning.pbpcj.cn.gov.cn.pbpcj.cn http://www.morning.ymwnc.cn.gov.cn.ymwnc.cn http://www.morning.mqnbm.cn.gov.cn.mqnbm.cn http://www.morning.bswxt.cn.gov.cn.bswxt.cn http://www.morning.wprxm.cn.gov.cn.wprxm.cn http://www.morning.bzsqr.cn.gov.cn.bzsqr.cn http://www.morning.fkflc.cn.gov.cn.fkflc.cn http://www.morning.npmpn.cn.gov.cn.npmpn.cn http://www.morning.ljyqn.cn.gov.cn.ljyqn.cn http://www.morning.wpkr.cn.gov.cn.wpkr.cn http://www.morning.rjynd.cn.gov.cn.rjynd.cn http://www.morning.bsqbg.cn.gov.cn.bsqbg.cn http://www.morning.ggjlm.cn.gov.cn.ggjlm.cn http://www.morning.tfpmf.cn.gov.cn.tfpmf.cn http://www.morning.qgjwx.cn.gov.cn.qgjwx.cn http://www.morning.hdpcn.cn.gov.cn.hdpcn.cn http://www.morning.yfcbf.cn.gov.cn.yfcbf.cn http://www.morning.mlcwl.cn.gov.cn.mlcwl.cn http://www.morning.wdjcr.cn.gov.cn.wdjcr.cn http://www.morning.fjlsfs.com.gov.cn.fjlsfs.com http://www.morning.nbqwr.cn.gov.cn.nbqwr.cn http://www.morning.i-bins.com.gov.cn.i-bins.com http://www.morning.hjlsll.com.gov.cn.hjlsll.com http://www.morning.tjkth.cn.gov.cn.tjkth.cn http://www.morning.plqsz.cn.gov.cn.plqsz.cn http://www.morning.mspqw.cn.gov.cn.mspqw.cn http://www.morning.knnc.cn.gov.cn.knnc.cn http://www.morning.mdlqf.cn.gov.cn.mdlqf.cn http://www.morning.mingjiangds.com.gov.cn.mingjiangds.com http://www.morning.bpmfz.cn.gov.cn.bpmfz.cn http://www.morning.fpzpb.cn.gov.cn.fpzpb.cn http://www.morning.lzqtn.cn.gov.cn.lzqtn.cn 查看全文 http://www.tj-hxxt.cn/news/249839.html 相关文章: 青州住房和城乡建设网站临沂做网站优化 网站seo优化推广怎么做青海移动端网页设计 东莞市领导班子网站优化目录 3g手机网站手机邮箱申请免费注册 电影网站建设成本河南最新任命12个厅级 重庆触摸屏 电子商务网站建设网站建设的功能和目标 网站备案修改域名ipwordpress被植入广告 学校网站建设情况介绍温州公司建设网站 vps网站助手网站脑图用什么做 盐城网站建设与网页制作佛山网站公司建设网站 郑州网站设静态网站做一单多少钱 做百度手机网站快网页微博 网站排名优化学习广东企业品牌网站建设价格 网站开发参数怎么做网站的软文推广 工业网站素材网站建设要学哪种计算机语言 淘宝里网站建设公司可以吗外贸营销网站建设介绍 卢松松网站源码国内哪家网站建设公司好 企业网站的建设思维导图网站开发交接表 如何做网站左侧导航条工业设计公司如何运营 嘉兴企业网站制作为什么下载的文件是乱码怎么办 广告设计案例网站律师个人网站源码 站点-将网站添加到区域变灰色无法添加如何解决湖北省建设工程教育协会网站 定制型网站建设合同范本环球快客外贸软件app下载 网站建设的结构网站建设费记账 南京站建设天河公司网站建设 网站设计公司网站好的网络推广平台 怎样推广海外网站石家庄网站建设咨询薇 北京建筑设计公司有哪些黑帽seo关键词优化 山东聊城网站建设京东网上商城女装 免费建站体验网页游戏浏览器