14
14
15
15
package apijson .framework ;
16
16
17
+ import java .rmi .ServerException ;
18
+
17
19
import apijson .NotNull ;
18
- import apijson .orm .ParserCreator ;
19
- import apijson .orm .SQLCreator ;
20
20
21
21
22
22
/**SpringBootApplication
@@ -32,31 +32,47 @@ public class APIJSONApplication {
32
32
}
33
33
34
34
35
- public static void init () throws Exception {
36
- init (true );
37
- }
38
- public static void init (boolean shutdownWhenServerError ) throws Exception {
39
- init (shutdownWhenServerError , null , null );
35
+ /**初始化,加载所有配置并校验
36
+ * @return
37
+ * @throws ServerException
38
+ */
39
+ public static void init () throws ServerException {
40
+ init (true , DEFAULT_APIJSON_CREATOR );
40
41
}
41
- public static void init (APIJSONCreator creator ) throws Exception {
42
- init (false , creator );
42
+ /**初始化,加载所有配置并校验
43
+ * @param shutdownWhenServerError
44
+ * @return
45
+ * @throws ServerException
46
+ */
47
+ public static void init (boolean shutdownWhenServerError ) throws ServerException {
48
+ init (shutdownWhenServerError , DEFAULT_APIJSON_CREATOR );
43
49
}
44
- public static void init (boolean shutdownWhenServerError , APIJSONCreator creator ) throws Exception {
45
- init (shutdownWhenServerError , creator , creator );
50
+ /**初始化,加载所有配置并校验
51
+ * @param creator
52
+ * @return
53
+ * @throws ServerException
54
+ */
55
+ public static void init (@ NotNull APIJSONCreator creator ) throws ServerException {
56
+ init (true , creator );
46
57
}
47
- public static void init (boolean shutdownWhenServerError , ParserCreator <Long > parserCreator , SQLCreator sqlCreator ) throws Exception {
58
+ /**初始化,加载所有配置并校验
59
+ * @param shutdownWhenServerError
60
+ * @param creator
61
+ * @return
62
+ * @throws ServerException
63
+ */
64
+ public static void init (boolean shutdownWhenServerError , @ NotNull APIJSONCreator creator ) throws ServerException {
48
65
System .out .println ("\n \n \n \n \n <<<<<<<<<<<<<<<<<<<<<<<<< APIJSON 开始启动 >>>>>>>>>>>>>>>>>>>>>>>>\n " );
66
+ DEFAULT_APIJSON_CREATOR = creator ;
49
67
50
- if (parserCreator == null ) {
51
- parserCreator = DEFAULT_APIJSON_CREATOR ;
52
- }
53
- if (sqlCreator == null ) {
54
- sqlCreator = DEFAULT_APIJSON_CREATOR ;
55
- }
68
+ // 统一用同一个 creator
69
+ APIJSONSQLConfig .APIJSON_CREATOR = creator ;
70
+ APIJSONParser .APIJSON_CREATOR = creator ;
71
+ APIJSONController .APIJSON_CREATOR = creator ;
56
72
57
73
System .out .println ("\n \n \n 开始初始化:远程函数配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n " );
58
74
try {
59
- APIJSONFunctionParser .init (shutdownWhenServerError , parserCreator );
75
+ APIJSONFunctionParser .init (shutdownWhenServerError , creator );
60
76
}
61
77
catch (Exception e ) {
62
78
e .printStackTrace ();
@@ -76,7 +92,7 @@ public static void init(boolean shutdownWhenServerError, ParserCreator<Long> par
76
92
77
93
System .out .println ("\n \n \n 开始初始化:请求校验配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n " );
78
94
try {
79
- StructureUtil .init (shutdownWhenServerError , parserCreator );
95
+ StructureUtil .init (shutdownWhenServerError , creator );
80
96
}
81
97
catch (Exception e ) {
82
98
e .printStackTrace ();
@@ -85,7 +101,7 @@ public static void init(boolean shutdownWhenServerError, ParserCreator<Long> par
85
101
86
102
System .out .println ("\n \n \n 开始测试:请求校验 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n " );
87
103
try {
88
- StructureUtil .test (sqlCreator );
104
+ StructureUtil .test ();
89
105
}
90
106
catch (Exception e ) {
91
107
e .printStackTrace ();
@@ -96,7 +112,7 @@ public static void init(boolean shutdownWhenServerError, ParserCreator<Long> par
96
112
97
113
System .out .println ("\n \n \n 开始初始化:权限校验配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n " );
98
114
try {
99
- APIJSONVerifier .init (shutdownWhenServerError , parserCreator );
115
+ APIJSONVerifier .init (shutdownWhenServerError , creator );
100
116
}
101
117
catch (Exception e ) {
102
118
e .printStackTrace ();
0 commit comments