diff options
author | Vitaly Takmazov | 2016-01-16 14:13:11 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-01-16 14:13:11 +0300 |
commit | 093a022955d547e6f94a4204a193c0e7296c11b2 (patch) | |
tree | 55bba7123a9549055e6001702712fffa35f8e801 | |
parent | fab3c7d5462cd0b54de3a8cdd377e3476fa90285 (diff) |
drop unneeded dependency
-rw-r--r-- | build.gradle | 1 | ||||
-rw-r--r-- | src/main/java/com/juick/api/Main.java | 16 | ||||
-rw-r--r-- | src/test/java/com/juick/tests/JsonTests.java | 6 |
3 files changed, 11 insertions, 12 deletions
diff --git a/build.gradle b/build.gradle index c2ca747e..380f5b39 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,6 @@ dependencies { compile xmpp compile json compile "org.springframework:spring-jdbc:4.2.4.RELEASE" - compile "org.apache.commons:commons-dbcp2:2.1.1" providedCompile 'javax.servlet:javax.servlet-api:3.1.0' def tomcatVersion = '7.0.+' tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}", diff --git a/src/main/java/com/juick/api/Main.java b/src/main/java/com/juick/api/Main.java index 71f7f2d7..4233c45d 100644 --- a/src/main/java/com/juick/api/Main.java +++ b/src/main/java/com/juick/api/Main.java @@ -20,9 +20,15 @@ package com.juick.api; 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 javax.servlet.ServletException; +import javax.servlet.annotation.MultipartConfig; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintWriter; @@ -31,12 +37,6 @@ import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; -import javax.servlet.ServletException; -import javax.servlet.annotation.MultipartConfig; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; /** * @@ -65,7 +65,7 @@ public class Main extends HttpServlet implements Stream.StreamListener { Class.forName(driverClassName); sql = DriverManager.getConnection("jdbc:mysql://localhost/juick?autoReconnect=true&user=" + conf.getProperty("mysql_username", "") + "&password=" + conf.getProperty("mysql_password", "")); sqlSearch = DriverManager.getConnection("jdbc:mysql://127.0.0.1:9306/juick?autoReconnect=true&characterEncoding=utf8&maxAllowedPacket=512000&relaxAutoCommit=true&user=root&password="); - BasicDataSource dataSource = new BasicDataSource(); + DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setUrl(sql.getMetaData().getURL()); dataSource.setDriverClassName(driverClassName); jdbc = new JdbcTemplate(dataSource); diff --git a/src/test/java/com/juick/tests/JsonTests.java b/src/test/java/com/juick/tests/JsonTests.java index 496dea24..795b3429 100644 --- a/src/test/java/com/juick/tests/JsonTests.java +++ b/src/test/java/com/juick/tests/JsonTests.java @@ -5,6 +5,8 @@ import com.juick.server.MessagesQueries; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.datasource.DriverManagerDataSource; import java.io.FileInputStream; import java.io.IOException; @@ -12,8 +14,6 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.List; import java.util.Properties; -import org.apache.commons.dbcp2.BasicDataSource; -import org.springframework.jdbc.core.JdbcTemplate; public class JsonTests { @@ -23,7 +23,7 @@ public class JsonTests { Properties conf = new Properties(); try { conf.load(new FileInputStream("/etc/juick/api.conf")); - BasicDataSource dataSource = new BasicDataSource(); + DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUrl("jdbc:mysql://localhost/juick?autoReconnect=true&user=" + conf.getProperty("mysql_username", "") |