diff options
author | Vitaly Takmazov | 2016-07-20 15:12:34 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-07-20 15:12:34 +0300 |
commit | c19397fb6d4635120a1a8cdaef6d66f0b36e3c4b (patch) | |
tree | 8840145f5eeefcf72715c80d00c9898555c32b35 /juick-www | |
parent | d5d21e26157f7a5821a68f53e043ad88b150fca3 (diff) |
DriverManagerDataSource -> BasicDataSource
Diffstat (limited to 'juick-www')
-rw-r--r-- | juick-www/build.gradle | 1 | ||||
-rw-r--r-- | juick-www/src/main/java/com/juick/www/Main.java | 6 | ||||
-rw-r--r-- | juick-www/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java | 4 |
3 files changed, 7 insertions, 4 deletions
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); |