diff --git a/pom.xml b/pom.xml index 7cf04e0a..5c475861 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,6 @@ 17 17 - UTF-8 SONIC_VERSION diff --git a/sonic-server-common/src/main/resources/application-jdbc.yml b/sonic-server-common/src/main/resources/application-jdbc.yml index e284cc7f..173c9e5f 100644 --- a/sonic-server-common/src/main/resources/application-jdbc.yml +++ b/sonic-server-common/src/main/resources/application-jdbc.yml @@ -7,9 +7,11 @@ spring: username: ${MYSQL_USERNAME:root} # mysql password password: ${MYSQL_PASSWORD:Sonic!@#123} - initialization-mode: always schema: - classpath:data.sql + sql: + init: + mode: always mybatis-plus: mapper-locations: classpath*:com/gitee/sunchenbin/mybatis/actable/mapping/*/*.xml diff --git a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/ControllerApplication.java b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/ControllerApplication.java index 03f3110d..6cf12e77 100644 --- a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/ControllerApplication.java +++ b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/ControllerApplication.java @@ -17,14 +17,12 @@ */ package org.cloud.sonic.controller; -import com.gitee.sunchenbin.mybatis.actable.manager.handler.StartUpHandler; import org.cloud.sonic.controller.tools.SpringTool; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.openfeign.EnableFeignClients; -import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Import; @@ -48,8 +46,6 @@ @Import(SpringTool.class) public class ControllerApplication { public static void main(String[] args) { - ConfigurableApplicationContext run = SpringApplication.run(ControllerApplication.class, args); - StartUpHandler createTable = run.getBean(StartUpHandler.class, args); - createTable.startHandler(); + SpringApplication.run(ControllerApplication.class, args); } } diff --git a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/config/mybatis/ActableConfig.java b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/config/mybatis/ActableConfig.java new file mode 100644 index 00000000..d18e4650 --- /dev/null +++ b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/config/mybatis/ActableConfig.java @@ -0,0 +1,37 @@ +/* + * sonic-server Sonic Cloud Real Machine Platform. + * Copyright (C) 2022 SonicCloudOrg + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.cloud.sonic.controller.config.mybatis; + +import com.gitee.sunchenbin.mybatis.actable.manager.handler.StartUpHandler; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.annotation.Order; + +@Configuration +@Order(1) +public class ActableConfig { + + @Autowired + private StartUpHandler startUpHandler; + + @Bean + public void generate() { + startUpHandler.startHandler(); + } +}