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

新手怎么做电商在哪个网站想卖产品怎么推广宣传

新手怎么做电商在哪个网站,想卖产品怎么推广宣传,嘉兴地区有人做网站吗,山西网络营销外包概述 因为项目中采集工厂中的设备码点的数据量比较大,需要集成TDengine时序数据库,所以需要设置双数据源 操作步骤 导入依赖 <!-- 多数据源支持 --><dependency><groupId>com.baomidou</groupId><artifactId>dynamic-datasource-spring-boot-s…

概述

因为项目中采集工厂中的设备码点的数据量比较大,需要集成TDengine时序数据库,所以需要设置双数据源

操作步骤

导入依赖

		<!-- 多数据源支持 --><dependency><groupId>com.baomidou</groupId><artifactId>dynamic-datasource-spring-boot-starter</artifactId><version>3.3.6</version></dependency><!-- taos连接驱动 --><dependency><groupId>com.taosdata.jdbc</groupId><artifactId>taos-jdbcdriver</artifactId><version>3.2.11</version></dependency>

 nacos 配置文件数据源修改

spring:servlet:multipart:max-file-size: 100MBmax-request-size: 100MBenabled: true# mysql 配置datasource:dynamic:primary: mysql-servertype: com.alibaba.druid.pool.DruidDataSourcemysql-server:driver-class-name: com.mysql.cj.jdbc.Driverjdbc-url: jdbc:mysql://ip:port/db?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghaiusername: usernamepassword: passwordinitial-size: 10max-active: 100min-idle: 10max-wait: 60000pool-prepared-statements: truemax-pool-prepared-statement-per-connection-size: 20time-between-eviction-runs-millis: 60000min-evictable-idle-time-millis: 300000test-while-idle: truetest-on-borrow: falsetest-on-return: falsestat-view-servlet:enabled: trueurl-pattern: /druid/*filter:stat:log-slow-sql: trueslow-sql-millis: 1000merge-sql: falsewall:config:multi-statement-allow: true# TDengine 配置tdengine-server:driver-class-name: com.taosdata.jdbc.rs.RestfulDriverjdbc-url: jdbc:TAOS-RS://ip:port/db?timezone=UTC-8&charset=utf-8username: usernamepassword: passwordpool-name: Data_trans_HikariCPminimum-idle: 10 #最小空闲连接数量idle-timeout: 600000 #空闲连接存活最大时间,默认600000(10分钟)maximum-pool-size: 100 #连接池最大连接数,默认是10auto-commit: true  #此属性控制从池返回的连接的默认自动提交行为,默认值:truemax-lifetime: 1800000 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟connection-timeout: 30000 #数据库连接超时时间,默认30秒,即30000

新增自定义数据源配置类

MySQL

/*** MySQL 双数据源配置* @author pumpkin* @date 2024/5/16 14:08*/
@Configuration
@MapperScan(basePackages = {"com.xxx.xxx.xxx.dao", "com.xxx.xxx.xxx.dao"}, sqlSessionTemplateRef  = "mysqlSqlSessionTemplate")
public class MysqlServerConfig {private final MybatisPlusProperties properties;public MysqlServerConfig(MybatisPlusProperties properties) {this.properties = properties;}@Bean(name = "mysqlDataSource")@ConfigurationProperties(prefix = "spring.datasource.mysql-server")@Primarypublic DataSource mysqlDataSource() {return DataSourceBuilder.create().build();}@Bean(name = "mysqlSqlSessionFactory")@Primarypublic SqlSessionFactory mysqlSqlSessionFactory(@Qualifier("mysqlDataSource") DataSource dataSource) throws Exception {
//        SqlSessionFactoryBean bean = new SqlSessionFactoryBean();MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();bean.setDataSource(dataSource);// 指定多个XML映射文件位置PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
//        bean.setMapperLocations(resolver.getResources("classpath*:/mapper/*.xml"));Resource[] resources1 = resolver.getResources("classpath*:mapper/**/*.xml");Resource[] resources2 = resolver.getResources("classpath*:mapper/*.xml");// 将多个资源数组合并为一个Resource[] mapperLocations = new Resource[resources1.length + resources2.length];System.arraycopy(resources1, 0, mapperLocations, 0, resources1.length);System.arraycopy(resources2, 0, mapperLocations, resources1.length, resources2.length);// 设置合并后的资源数组bean.setMapperLocations(mapperLocations);//        MybatisConfiguration configuration = this.properties.getConfiguration();
//        if (configuration == null && !StringUtils.hasText(this.properties.getConfigLocation())) {
//            configuration = new MybatisConfiguration();
//        }MybatisConfiguration configuration = new MybatisConfiguration();configuration.setMapUnderscoreToCamelCase(true);configuration.setDefaultFetchSize(100);configuration.setDefaultStatementTimeout(30);bean.setConfiguration(configuration);return bean.getObject();}@Bean(name = "mysqlTransactionManager")@Primarypublic DataSourceTransactionManager mysqlTransactionManager(@Qualifier("mysqlDataSource") DataSource dataSource) {return new DataSourceTransactionManager(dataSource);}@Bean(name = "mysqlSqlSessionTemplate")@Primarypublic SqlSessionTemplate mysqlSqlSessionTemplate(@Qualifier("mysqlSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {return new SqlSessionTemplate(sqlSessionFactory);}
}

TDengine

/*** TDengine 双数据源配置* @author pumpkin* @date 2024/5/16 14:08*/
@Configuration
@MapperScan(basePackages = {"com.xxx.xxx.xxx.tdengine"}, sqlSessionTemplateRef  = "tdengineSqlSessionTemplate")
public class TDengineServerConfig {@Bean(name = "tdengineDataSource")@ConfigurationProperties(prefix = "spring.datasource.tdengine-server")public DataSource tdengineDataSource() {return DataSourceBuilder.create().build();}@Bean(name = "tdengineSqlSessionFactory")public SqlSessionFactory tdengineSqlSessionFactory(@Qualifier("tdengineDataSource") DataSource dataSource) throws Exception {SqlSessionFactoryBean bean = new SqlSessionFactoryBean();bean.setDataSource(dataSource);bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/tdengine/*.xml"));return bean.getObject();}@Bean(name = "tdengineTransactionManager")public DataSourceTransactionManager tdengineTransactionManager(@Qualifier("tdengineDataSource") DataSource dataSource) {return new DataSourceTransactionManager(dataSource);}@Bean(name = "tdengineSqlSessionTemplate")public SqlSessionTemplate tdengineSqlSessionTemplate(@Qualifier("tdengineSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {return new SqlSessionTemplate(sqlSessionFactory);}}

将访问对应数据源的 Mapper 类放在对应的包下,使用 DAO 或者 Mapper 层的方法的时候就会操作对应的数据源了

http://www.ds6.com.cn/news/9204.html

相关文章:

  • 网站开发设计制作推广百度系app
  • 新郑做网站太原百度seo排名软件
  • 赌博网站到底怎么做最新军事消息
  • 南宁网站建设优化排名35个成功的市场营销策划案例
  • 网页设计制作多少钱谷歌搜索优化
  • 专业的网站建设费用种子资源地址
  • 贵阳建设工程招聘信息网站如何在百度上发表文章
  • 临湘做网站seo优化方式
  • 大学生软件开发项目推荐seo网络搜索引擎优化
  • 济南做企业网站公司域名ip地址在线查询
  • 做网站还有市场吗宁波网络推广联系方式
  • 肇庆做网站建设培训心得体会1000字通用
  • 太原seo网站排名优化网站百度不收录的原因
  • 网站前台和后台设计最有效的推广学校的方式
  • 做网站用什么源码好关键词优化设计
  • vs网站开发 百度文库厦门seo管理
  • 自己建网站可以赚钱吗如何创建一个属于自己的网站
  • vb做网站玩推广之家
  • smjiaoliu wordpressseo网站排名优化培训教程
  • 帝国网站后台管理系统企业营销培训课程
  • 赣州市城乡建设局官方网站网站功能优化
  • 响应式网站设计教程江阴百度推广公司
  • 做会展网站的关键词2345网址导航桌面版
  • 汇中建设 官方网站房管局备案查询网站
  • 做网站换服务器怎么整手机百度下载免费安装
  • 网站推广主要用的软件下载百度app
  • 德庆网站建设价格市场调研公司排名
  • 大连宏帝建设网站怎么样引流加微信
  • 网站建设基本步骤杭州seo关键词优化公司
  • 网站建设套定额营销伎巧第一季