Skip to content

Commit f9c10b6

Browse files
committed
add Quill support
1 parent 80138b1 commit f9c10b6

File tree

10 files changed

+44
-13
lines changed

10 files changed

+44
-13
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>net.csdn</groupId>
66
<artifactId>ServiceFramework_2.11</artifactId>
77
<packaging>pom</packaging>
8-
<version>2.0.1</version>
8+
<version>2.0.2</version>
99
<name>ServiceFramework</name>
1010
<description>Java MVC framework, agile, fast, rich domain model, made especially for server side of mobile
1111
application

serviceframework-common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>ServiceFramework_2.11</artifactId>
88
<groupId>net.csdn</groupId>
9-
<version>2.0.1</version>
9+
<version>2.0.2</version>
1010
</parent>
1111
<artifactId>serviceframework-common_2.11</artifactId>
1212

serviceframework-dispatcher/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>ServiceFramework_2.11</artifactId>
77
<groupId>net.csdn</groupId>
8-
<version>2.0.1</version>
8+
<version>2.0.2</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

serviceframework-jetty-9-server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>ServiceFramework_2.11</artifactId>
77
<groupId>net.csdn</groupId>
8-
<version>2.0.1</version>
8+
<version>2.0.2</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111
<modelVersion>4.0.0</modelVersion>

serviceframework-mongo/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>ServiceFramework_2.11</artifactId>
77
<groupId>net.csdn</groupId>
8-
<version>2.0.1</version>
8+
<version>2.0.2</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111
<modelVersion>4.0.0</modelVersion>

serviceframework-orm/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>ServiceFramework_2.11</artifactId>
77
<groupId>net.csdn</groupId>
8-
<version>2.0.1</version>
8+
<version>2.0.2</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111
<modelVersion>4.0.0</modelVersion>
@@ -40,6 +40,11 @@
4040
<artifactId>druid</artifactId>
4141
<version>0.2.26</version>
4242
</dependency>
43+
<dependency>
44+
<groupId>io.getquill</groupId>
45+
<artifactId>quill-jdbc_${scala.binary.version}</artifactId>
46+
<version>3.4.10</version>
47+
</dependency>
4348

4449
</dependencies>
4550

serviceframework-orm/src/main/java/net/csdn/jpa/JPA.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,18 @@ public class JPA {
7272

7373
public static void configure(CSDNORMConfiguration csdnormConfiguration) {
7474
ormConfiguration = csdnormConfiguration;
75-
ormConfiguration.buildDefaultDBInfo();
76-
loadModels();
77-
try {
78-
new ValidatorLoader().load();
79-
} catch (Exception e) {
80-
e.printStackTrace();
75+
if (!ormConfiguration.settings.getAsBoolean(JPA.mode() + ".datasources.mysql.quill", false)) {
76+
ormConfiguration.buildDefaultDBInfo();
77+
loadModels();
78+
try {
79+
new ValidatorLoader().load();
80+
} catch (Exception e) {
81+
e.printStackTrace();
82+
}
83+
} else {
84+
8185
}
86+
8287
}
8388

8489
public static synchronized JPAConfig getJPAConfig() {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package net.csdn.jpa
2+
3+
import io.getquill.{Literal, MysqlJdbcContext, SnakeCase}
4+
import net.csdn.jpa.model.JPABase
5+
6+
/**
7+
* 21/11/2019 WilliamZhu(allwefantasy@gmail.com)
8+
*/
9+
object QuillDB {
10+
def createDataSource: javax.sql.DataSource with java.io.Closeable = {
11+
JPABase.mysqlClient.defaultMysqlService().dataSource().asInstanceOf[javax.sql.DataSource with java.io.Closeable]
12+
}
13+
14+
lazy val ctx = new MysqlJdbcContext(SnakeCase, createDataSource)
15+
}

serviceframework-web/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>ServiceFramework_2.11</artifactId>
77
<groupId>net.csdn</groupId>
8-
<version>2.0.1</version>
8+
<version>2.0.2</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111
<modelVersion>4.0.0</modelVersion>

serviceframework-web/src/main/java/net/csdn/bootstrap/loader/impl/ControllerLoader.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,17 @@ protected void configure() {
117117
API api = ServiceFramwork.injector.getInstance(API.class);
118118
NoAction noAction = method.getAnnotation(NoAction.class);
119119
if (noAction != null) {
120+
if (restController.defaultHandlerKey() != null) {
121+
throw new RuntimeException("Only one default action can be defined. current is " + method.getName());
122+
}
120123
restController.setDefaultHandlerKey(new Tuple<Class<ApplicationController>, Method>(clzz, method));
121124
}
122125

123126
ErrorAction errorAction = method.getAnnotation(ErrorAction.class);
124127
if (errorAction != null) {
128+
if (restController.errorHandlerKey() != null) {
129+
throw new RuntimeException("Only one error action can be defined. current is " + method.getName());
130+
}
125131
restController.setErrorHandlerKey(new Tuple<Class<ApplicationController>, Method>(clzz, method));
126132
}
127133

0 commit comments

Comments
 (0)