1414
1515package apijson .framework ;
1616
17+ import java .rmi .ServerException ;
18+
1719import apijson .NotNull ;
18- import apijson .orm .ParserCreator ;
19- import apijson .orm .SQLCreator ;
2020
2121
2222/**SpringBootApplication
@@ -32,31 +32,47 @@ public class APIJSONApplication {
3232 }
3333
3434
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 );
4041 }
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 );
4349 }
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 );
4657 }
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 {
4865 System .out .println ("\n \n \n \n \n <<<<<<<<<<<<<<<<<<<<<<<<< APIJSON 开始启动 >>>>>>>>>>>>>>>>>>>>>>>>\n " );
66+ DEFAULT_APIJSON_CREATOR = creator ;
4967
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 ;
5672
5773 System .out .println ("\n \n \n 开始初始化:远程函数配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n " );
5874 try {
59- APIJSONFunctionParser .init (shutdownWhenServerError , parserCreator );
75+ APIJSONFunctionParser .init (shutdownWhenServerError , creator );
6076 }
6177 catch (Exception e ) {
6278 e .printStackTrace ();
@@ -76,7 +92,7 @@ public static void init(boolean shutdownWhenServerError, ParserCreator<Long> par
7692
7793 System .out .println ("\n \n \n 开始初始化:请求校验配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n " );
7894 try {
79- StructureUtil .init (shutdownWhenServerError , parserCreator );
95+ StructureUtil .init (shutdownWhenServerError , creator );
8096 }
8197 catch (Exception e ) {
8298 e .printStackTrace ();
@@ -85,7 +101,7 @@ public static void init(boolean shutdownWhenServerError, ParserCreator<Long> par
85101
86102 System .out .println ("\n \n \n 开始测试:请求校验 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n " );
87103 try {
88- StructureUtil .test (sqlCreator );
104+ StructureUtil .test ();
89105 }
90106 catch (Exception e ) {
91107 e .printStackTrace ();
@@ -96,7 +112,7 @@ public static void init(boolean shutdownWhenServerError, ParserCreator<Long> par
96112
97113 System .out .println ("\n \n \n 开始初始化:权限校验配置 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n " );
98114 try {
99- APIJSONVerifier .init (shutdownWhenServerError , parserCreator );
115+ APIJSONVerifier .init (shutdownWhenServerError , creator );
100116 }
101117 catch (Exception e ) {
102118 e .printStackTrace ();
0 commit comments