中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

自己做的網(wǎng)站服務器開了進不去百度號碼認證平臺官網(wǎng)

自己做的網(wǎng)站服務器開了進不去,百度號碼認證平臺官網(wǎng),滄州鉑藝科技網(wǎng)絡(luò)有限公司,做棋牌網(wǎng)站要什么源碼概述 因為項目中采集工廠中的設(shè)備碼點的數(shù)據(jù)量比較大,需要集成TDengine時序數(shù)據(jù)庫,所以需要設(shè)置雙數(shù)據(jù)源 操作步驟 導入依賴 <!-- 多數(shù)據(jù)源支持 --><dependency><groupId>com.baomidou</groupId><artifactId>dynamic-datasource-spring-boot-s…

概述

因為項目中采集工廠中的設(shè)備碼點的數(shù)據(jù)量比較大,需要集成TDengine時序數(shù)據(jù)庫,所以需要設(shè)置雙數(shù)據(jù)源

操作步驟

導入依賴

		<!-- 多數(shù)據(jù)源支持 --><dependency><groupId>com.baomidou</groupId><artifactId>dynamic-datasource-spring-boot-starter</artifactId><version>3.3.6</version></dependency><!-- taos連接驅(qū)動 --><dependency><groupId>com.taosdata.jdbc</groupId><artifactId>taos-jdbcdriver</artifactId><version>3.2.11</version></dependency>

?nacos 配置文件數(shù)據(jù)源修改

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 #最小空閑連接數(shù)量idle-timeout: 600000 #空閑連接存活最大時間,默認600000(10分鐘)maximum-pool-size: 100 #連接池最大連接數(shù),默認是10auto-commit: true  #此屬性控制從池返回的連接的默認自動提交行為,默認值:truemax-lifetime: 1800000 #此屬性控制池中連接的最長生命周期,值0表示無限生命周期,默認1800000即30分鐘connection-timeout: 30000 #數(shù)據(jù)庫連接超時時間,默認30秒,即30000

新增自定義數(shù)據(jù)源配置類

MySQL

/*** MySQL 雙數(shù)據(jù)源配置* @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");// 將多個資源數(shù)組合并為一個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);// 設(shè)置合并后的資源數(shù)組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 雙數(shù)據(jù)源配置* @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);}}

將訪問對應數(shù)據(jù)源的 Mapper 類放在對應的包下,使用 DAO 或者 Mapper 層的方法的時候就會操作對應的數(shù)據(jù)源了

http://www.risenshineclean.com/news/5038.html

相關(guān)文章:

  • 微信公眾平臺制作網(wǎng)站58網(wǎng)絡(luò)推廣
  • 風訊網(wǎng)站內(nèi)容管理系統(tǒng)西安網(wǎng)站建設(shè)公司電話
  • 自助建站申請書網(wǎng)絡(luò)營銷方案有哪些
  • 電競logo免費設(shè)計西安百度推廣優(yōu)化公司
  • 免費電商網(wǎng)站建設(shè)中國培訓網(wǎng)官網(wǎng)
  • 建設(shè)網(wǎng)站的公司興田德潤怎么聯(lián)系北京企業(yè)網(wǎng)站seo平臺
  • 濰坊網(wǎng)站建設(shè)聯(lián)系方式東莞網(wǎng)站seo公司哪家大
  • 網(wǎng)頁源代碼快捷鍵湘潭seo優(yōu)化
  • 做援交的網(wǎng)站100個常用的關(guān)鍵詞
  • php仿百度網(wǎng)站源碼關(guān)鍵詞的分類和優(yōu)化
  • 西安做網(wǎng)站找騰帆最近一周的新聞大事10條
  • 國產(chǎn)一級a做爰片免費網(wǎng)站網(wǎng)頁設(shè)計與制作項目教程
  • 網(wǎng)站前臺功能模塊設(shè)計品牌營銷策略四種類型
  • shanxi建設(shè)銀行網(wǎng)站首頁seo全國最好的公司
  • 展示網(wǎng)站多少錢一個網(wǎng)站熱度查詢
  • 個人音樂網(wǎng)站建設(shè)武漢seo主管
  • 網(wǎng)站模板 帶數(shù)據(jù)庫抖音seo
  • 網(wǎng)絡(luò)營銷計劃的七個步驟鄭州seo實戰(zhàn)培訓
  • 天津西青區(qū)離哪個火車站近線上推廣
  • 做視頻網(wǎng)站服務器怎么選擇圖片搜索圖片識別
  • 雙語網(wǎng)站管理系統(tǒng) div css百度seo關(guān)鍵詞優(yōu)化排名
  • 替別人做網(wǎng)站管理員河源今日頭條新聞最新
  • 網(wǎng)站建設(shè)公司巨頭今日頭條官網(wǎng)首頁
  • 男孩子怎么做網(wǎng)站賺錢百度推廣售后服務電話
  • 給企業(yè)做網(wǎng)站的業(yè)務員免費注冊個人網(wǎng)站
  • 做網(wǎng)站需要用socket嗎網(wǎng)頁設(shè)計代碼
  • 天城建設(shè)網(wǎng)站免費創(chuàng)建屬于自己的網(wǎng)站
  • 如何在網(wǎng)站上做淘寶客推廣蘭州網(wǎng)站seo優(yōu)化
  • 網(wǎng)站建設(shè)價格是多少直通車推廣技巧
  • 網(wǎng)站建設(shè)視頻vsseo網(wǎng)站優(yōu)化培訓價格