aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-07-20 15:12:34 +0300
committerGravatar Vitaly Takmazov2016-07-20 15:12:34 +0300
commitc19397fb6d4635120a1a8cdaef6d66f0b36e3c4b (patch)
tree8840145f5eeefcf72715c80d00c9898555c32b35
parentd5d21e26157f7a5821a68f53e043ad88b150fca3 (diff)
DriverManagerDataSource -> BasicDataSource
-rw-r--r--juick-api/build.gradle1
-rw-r--r--juick-api/src/main/java/com/juick/api/Main.java4
-rw-r--r--juick-rss/build.gradle1
-rw-r--r--juick-rss/src/main/java/com/juick/rss/Main.java4
-rw-r--r--juick-ws/build.gradle1
-rw-r--r--juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java7
-rw-r--r--juick-www/build.gradle1
-rw-r--r--juick-www/src/main/java/com/juick/www/Main.java6
-rw-r--r--juick-www/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java4
9 files changed, 16 insertions, 13 deletions
diff --git a/juick-api/build.gradle b/juick-api/build.gradle
index e1533883..4b8ce36a 100644
--- a/juick-api/build.gradle
+++ b/juick-api/build.gradle
@@ -26,6 +26,7 @@ dependencies {
compile 'com.github.pengrad:java-telegram-bot-api:2.1.1'
compile 'org.msbotframework4j:msbotframework4j-builder:0.1.4'
compile 'com.neovisionaries:nv-websocket-client:1.27'
+ compile 'org.apache.commons:commons-dbcp2:2.0'
providedRuntime 'mysql:mysql-connector-java:5.1.39'
}
compileJava.options.encoding = 'UTF-8'
diff --git a/juick-api/src/main/java/com/juick/api/Main.java b/juick-api/src/main/java/com/juick/api/Main.java
index 5a495ba2..676aab79 100644
--- a/juick-api/src/main/java/com/juick/api/Main.java
+++ b/juick-api/src/main/java/com/juick/api/Main.java
@@ -30,8 +30,8 @@ import com.juick.xmpp.StreamComponent;
import com.juick.xmpp.extensions.JuickMessage;
import com.juick.xmpp.extensions.Nickname;
import com.juick.xmpp.extensions.XOOB;
+import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.datasource.DriverManagerDataSource;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
@@ -75,7 +75,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
LogManager.getLogManager().readConfiguration(getServletContext().getResourceAsStream("/WEB-INF/logging.properties"));
Properties conf = new Properties();
conf.load(getServletContext().getResourceAsStream("/WEB-INF/juick.conf"));
- DriverManagerDataSource dataSource = new DriverManagerDataSource();
+ BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(conf.getProperty("datasource_driver", "com.mysql.jdbc.Driver"));
dataSource.setUrl(conf.getProperty("datasource_url"));
jdbc = new JdbcTemplate(dataSource);
diff --git a/juick-rss/build.gradle b/juick-rss/build.gradle
index 19a128e3..87f13e50 100644
--- a/juick-rss/build.gradle
+++ b/juick-rss/build.gradle
@@ -10,6 +10,7 @@ dependencies {
compile project(':juick-core')
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
testCompile 'junit:junit:4.12'
+ compile 'org.apache.commons:commons-dbcp2:2.0'
providedRuntime 'mysql:mysql-connector-java:5.1.39'
}
diff --git a/juick-rss/src/main/java/com/juick/rss/Main.java b/juick-rss/src/main/java/com/juick/rss/Main.java
index fd4deca3..46e06677 100644
--- a/juick-rss/src/main/java/com/juick/rss/Main.java
+++ b/juick-rss/src/main/java/com/juick/rss/Main.java
@@ -20,8 +20,8 @@ package com.juick.rss;
import com.juick.Message;
import com.juick.server.MessagesQueries;
import com.juick.server.UserQueries;
+import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.datasource.DriverManagerDataSource;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
@@ -52,7 +52,7 @@ public class Main extends HttpServlet {
try {
Properties conf = new Properties();
conf.load(getServletContext().getResourceAsStream("/WEB-INF/juick.conf"));
- DriverManagerDataSource dataSource = new DriverManagerDataSource();
+ BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(conf.getProperty("datasource_driver", "com.mysql.jdbc.Driver"));
dataSource.setUrl(conf.getProperty("datasource_url"));
sql = new JdbcTemplate(dataSource);
diff --git a/juick-ws/build.gradle b/juick-ws/build.gradle
index 111c0d5d..a46f3b9f 100644
--- a/juick-ws/build.gradle
+++ b/juick-ws/build.gradle
@@ -16,6 +16,7 @@ dependencies {
compile "org.springframework:spring-websocket:${springFrameworkVersion}"
compile 'javax.inject:javax.inject:1'
compile 'org.apache.httpcomponents:httpclient:4.5.1'
+ compile 'org.apache.commons:commons-dbcp2:2.0'
testCompile 'junit:junit:4.12'
providedRuntime 'mysql:mysql-connector-java:5.1.39'
}
diff --git a/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java b/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
index fbc6226b..d432b19c 100644
--- a/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
+++ b/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
@@ -2,17 +2,14 @@ package com.juick.ws.configuration;
import com.juick.ws.WebsocketComponent;
import com.juick.ws.XMPPConnection;
+import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.datasource.DriverManagerDataSource;
-import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
-import org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
@@ -45,7 +42,7 @@ public class WebsocketConfiguration extends WebMvcConfigurationSupport implement
}
@Bean
JdbcTemplate jdbc() {
- DriverManagerDataSource dataSource = new DriverManagerDataSource();
+ BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(env.getProperty("datasource_driver", "com.mysql.jdbc.Driver"));
dataSource.setUrl(env.getProperty("datasource_url"));
return new JdbcTemplate(dataSource);
diff --git a/juick-www/build.gradle b/juick-www/build.gradle
index f09abb3a..22d9672e 100644
--- a/juick-www/build.gradle
+++ b/juick-www/build.gradle
@@ -35,6 +35,7 @@ dependencies {
compile 'org.apache.httpcomponents:httpclient:4.5.1'
compile 'org.apache.commons:commons-lang3:3.4'
compile "org.springframework:spring-jdbc:4.3.1.RELEASE"
+ compile 'org.apache.commons:commons-dbcp2:2.0'
compile 'org.json:json:20151123'
testCompile 'junit:junit:4.12'
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
diff --git a/juick-www/src/main/java/com/juick/www/Main.java b/juick-www/src/main/java/com/juick/www/Main.java
index c39c152c..d7ecd0cb 100644
--- a/juick-www/src/main/java/com/juick/www/Main.java
+++ b/juick-www/src/main/java/com/juick/www/Main.java
@@ -21,8 +21,8 @@ import com.juick.server.UserQueries;
import com.juick.xmpp.JID;
import com.juick.xmpp.Stream;
import com.juick.xmpp.StreamComponent;
+import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.datasource.DriverManagerDataSource;
import ru.sape.Sape;
import javax.servlet.ServletException;
@@ -71,10 +71,10 @@ public class Main extends HttpServlet implements Stream.StreamListener {
Properties conf = new Properties();
conf.load(getServletContext().getResourceAsStream("/WEB-INF/juick.conf"));
- DriverManagerDataSource dataSource = new DriverManagerDataSource();
+ BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(conf.getProperty("datasource_driver", "com.mysql.jdbc.Driver"));
dataSource.setUrl(conf.getProperty("datasource_url"));
- DriverManagerDataSource dataSourceSearch = new DriverManagerDataSource();
+ BasicDataSource dataSourceSearch = new BasicDataSource();
dataSourceSearch.setDriverClassName(conf.getProperty("datasource_driver", "com.mysql.jdbc.Driver"));
dataSourceSearch.setUrl(sqlSearchConnStr);
sql = new JdbcTemplate(dataSource);
diff --git a/juick-www/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java b/juick-www/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java
index 4fb40e23..57072cee 100644
--- a/juick-www/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java
+++ b/juick-www/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java
@@ -8,6 +8,8 @@ import com.juick.xmpp.*;
import com.juick.xmpp.extensions.JuickMessage;
import com.juick.xmpp.extensions.Nickname;
import com.juick.xmpp.extensions.XOOB;
+import org.apache.commons.dbcp2.BasicDataSource;
+import org.apache.commons.dbcp2.PoolingDataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.xmlpull.v1.XmlPullParserException;
@@ -184,7 +186,7 @@ public class XMPPComponent implements ServletContextListener, Stream.StreamListe
keystorePassword = conf.getProperty("keystore_password");
brokenSSLhosts = Arrays.asList(conf.getProperty("broken_ssl_hosts", "").split(","));
bannedHosts = Arrays.asList(conf.getProperty("banned_hosts", "").split(","));
- DriverManagerDataSource dataSource = new DriverManagerDataSource();
+ BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(conf.getProperty("datasource_driver", "com.mysql.jdbc.Driver"));
dataSource.setUrl(conf.getProperty("datasource_url"));
sql = new JdbcTemplate(dataSource);