最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

SpringBoot發(fā)現(xiàn)最新版Druid重大問題(坑)

 更新時間:2020年09月27日 09:24:12   作者:馮曉東技術(shù)博客18649325921  
這篇文章主要介紹了SpringBoot發(fā)現(xiàn)最新版Druid重大問題(坑),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

發(fā)現(xiàn)Druid問題

最近做項目,遇到大量插入的地方,經(jīng)過大量的調(diào)試,最終發(fā)現(xiàn)是Druid連接池的問題,(以前一個大項目就遇到過Druid的坑),果斷換成c3p0之后,壓力測試嘩嘩上去了。

下面是更換c3p0方法。

1.修改pom.xml

導(dǎo)入c3p0依賴:

<dependency>
  <groupId>com.mchange</groupId>
  <artifactId>c3p0</artifactId>
  <version>0.9.5.5</version>
</dependency>

2.修改application.yml

spring:
 application:
  name: nh-tst
 http:
  encoding:
   charset: UTF-8
   enabled: true
   force: true
 datasource:
  driver-class-name: oracle.jdbc.driver.OracleDriver
 jpa:
  hibernate:
   ddl-auto: none
  show-sql: true
c3p0:
 jdbcUrl: jdbc:oracle:thin:@xxxxx:1522/prodpdb1
 user: xxxxxx
 password: xxxxxx
 driverClass: oracle.jdbc.driver.OracleDriver
 minPoolSize: 3
 maxPoolSize: 30
 maxIdleTime: 1800000
 acquireIncrement: 120
 maxStatements: 100000
 initialPoolSize: 5
 idleConnectionTestPeriod: 60
 acquireRetryAttempts: 30
 acquireRetryDelay: 10000
 breakAfterAcquireFailure: false
 testConnectionOnCheckout: false

3.增加DataSourceConfiguration.java類

package com.nh.fk.tst.config;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Qualifier;
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.context.annotation.Primary;
import com.mchange.v2.c3p0.ComboPooledDataSource;

@Configuration
public class DataSourceConfiguration {
 // c3p0 連接池
 @Bean(name = "dataSource")
 @Qualifier(value = "dataSource")
 @Primary
 @ConfigurationProperties(prefix = "c3p0")
 public DataSource dataSource() {
 return DataSourceBuilder.create().type(ComboPooledDataSource.class).build();
 }
}

打包,執(zhí)行:世界又恢復(fù)了和平??!

到此這篇關(guān)于SpringBoot發(fā)現(xiàn)最新版Druid重大問題(坑)的文章就介紹到這了,更多相關(guān)SpringBoot Druid內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

泾阳县| 沿河| 定边县| 东方市| 延吉市| 贵阳市| 织金县| 临沂市| 安顺市| 正阳县| 临澧县| 六盘水市| 彝良县| 象州县| 五华县| 仁怀市| 焦作市| 出国| 宁明县| 永春县| 临泉县| 托克托县| 宣威市| 公主岭市| 奇台县| 永登县| 吉首市| 百色市| 慈溪市| 大理市| 广河县| 博爱县| 金堂县| 宁夏| 建阳市| 开鲁县| 驻马店市| 册亨县| 延川县| 霍林郭勒市| 临泽县|