浏览代码

数据源改成Druid

zhh 6 年之前
父节点
当前提交
3ecffb1554

+ 1 - 0
README.md

@@ -18,6 +18,7 @@ RabbitMq | 消息队列
 Redis | 分布式缓存
 MongoDb | NoSql数据库
 Docker | 应用容器引擎
+Druid | 数据库连接池
 
 ### 前端技术
 

+ 6 - 0
mall-admin/pom.xml

@@ -91,6 +91,12 @@
             <artifactId>logstash-logback-encoder</artifactId>
             <version>4.8</version>
         </dependency>
+        <!--集成druid连接池-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.1.10</version>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 15 - 1
mall-admin/src/main/resources/application-dev.properties

@@ -2,4 +2,18 @@
 spring.datasource.url=jdbc:mysql://localhost:3306/mall
 spring.datasource.username=root
 spring.datasource.password=root
-#===datasource end===
+#===datasource end===
+
+#===druid start===
+#连接池初始化大小
+spring.datasource.druid.initial-size=5
+#最小空闲连接数
+spring.datasource.druid.min-idle=10
+#最大连接数
+spring.datasource.druid.max-active=20
+#不统计这些请求数据
+spring.datasource.druid.web-stat-filter.exclusions=*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*
+#访问监控网页的登录用户名和密码
+spring.datasource.druid.stat-view-servlet.login-username=druid
+spring.datasource.druid.stat-view-servlet.login-password=druid
+#===druid end===

+ 15 - 1
mall-admin/src/main/resources/application-prod.properties

@@ -2,4 +2,18 @@
 spring.datasource.url=jdbc:mysql://db:3306/mall
 spring.datasource.username=root
 spring.datasource.password=root
-#===datasource end===
+#===datasource end===
+
+#===druid start===
+#连接池初始化大小
+spring.datasource.druid.initial-size=5
+#最小空闲连接数
+spring.datasource.druid.min-idle=10
+#最大连接数
+spring.datasource.druid.max-active=20
+#不统计这些请求数据
+spring.datasource.druid.web-stat-filter.exclusions=*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*
+#访问监控网页的登录用户名和密码
+spring.datasource.druid.stat-view-servlet.login-username=druid
+spring.datasource.druid.stat-view-servlet.login-password=druid
+#===druid end===

+ 6 - 0
mall-portal/pom.xml

@@ -75,6 +75,12 @@
             <artifactId>spring-boot-starter-redis</artifactId>
             <version>1.3.8.RELEASE</version>
         </dependency>
+        <!--集成druid连接池-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.1.10</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 14 - 0
mall-portal/src/main/resources/application-dev.properties

@@ -19,6 +19,20 @@ spring.datasource.username=root
 spring.datasource.password=root
 #===datasource end===
 
+#===druid start===
+#连接池初始化大小
+spring.datasource.druid.initial-size=5
+#最小空闲连接数
+spring.datasource.druid.min-idle=10
+#最大连接数
+spring.datasource.druid.max-active=20
+#不统计这些请求数据
+spring.datasource.druid.web-stat-filter.exclusions=*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*
+#访问监控网页的登录用户名和密码
+spring.datasource.druid.stat-view-servlet.login-username=druid
+spring.datasource.druid.stat-view-servlet.login-password=druid
+#===druid end===
+
 #===mongodb start===
 spring.data.mongodb.host=localhost
 spring.data.mongodb.port=27017

+ 14 - 0
mall-portal/src/main/resources/application-prod.properties

@@ -8,6 +8,20 @@ spring.datasource.username=root
 spring.datasource.password=root
 #===datasource end===
 
+#===druid start===
+#连接池初始化大小
+spring.datasource.druid.initial-size=5
+#最小空闲连接数
+spring.datasource.druid.min-idle=10
+#最大连接数
+spring.datasource.druid.max-active=20
+#不统计这些请求数据
+spring.datasource.druid.web-stat-filter.exclusions=*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*
+#访问监控网页的登录用户名和密码
+spring.datasource.druid.stat-view-servlet.login-username=druid
+spring.datasource.druid.stat-view-servlet.login-password=druid
+#===druid end===
+
 #===mongodb start===
 spring.data.mongodb.host=mongo
 spring.data.mongodb.port=27017

+ 6 - 0
mall-search/pom.xml

@@ -61,6 +61,12 @@
             <artifactId>springfox-swagger-ui</artifactId>
             <version>2.6.1</version>
         </dependency>
+        <!--集成druid连接池-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.1.10</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 14 - 0
mall-search/src/main/resources/application-dev.properties

@@ -4,6 +4,20 @@ spring.datasource.username=root
 spring.datasource.password=root
 #===datasource end===
 
+#===druid start===
+#连接池初始化大小
+spring.datasource.druid.initial-size=5
+#最小空闲连接数
+spring.datasource.druid.min-idle=10
+#最大连接数
+spring.datasource.druid.max-active=20
+#不统计这些请求数据
+spring.datasource.druid.web-stat-filter.exclusions=*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*
+#访问监控网页的登录用户名和密码
+spring.datasource.druid.stat-view-servlet.login-username=druid
+spring.datasource.druid.stat-view-servlet.login-password=druid
+#===druid end===
+
 #===es start===
 spring.data.elasticsearch.repositories.enabled = true
 spring.data.elasticsearch.cluster-nodes = 127.0.0.1:9300

+ 14 - 0
mall-search/src/main/resources/application-prod.properties

@@ -4,6 +4,20 @@ spring.datasource.username=root
 spring.datasource.password=root
 #===datasource end===
 
+#===druid start===
+#连接池初始化大小
+spring.datasource.druid.initial-size=5
+#最小空闲连接数
+spring.datasource.druid.min-idle=10
+#最大连接数
+spring.datasource.druid.max-active=20
+#不统计这些请求数据
+spring.datasource.druid.web-stat-filter.exclusions=*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*
+#访问监控网页的登录用户名和密码
+spring.datasource.druid.stat-view-servlet.login-username=druid
+spring.datasource.druid.stat-view-servlet.login-password=druid
+#===druid end===
+
 #===es start===
 spring.data.elasticsearch.repositories.enabled = true
 spring.data.elasticsearch.cluster-nodes = es:9300