From 7df8ed14d605bcc731341ff12349bc117714b69e Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期四, 17 四月 2025 16:18:24 +0800
Subject: [PATCH] 优化代码
---
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/PipIrrMwRtuApplication.java | 63 +++++++++++++++++++++++++++++++
1 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/PipIrrMwRtuApplication.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/PipIrrMwRtuApplication.java
new file mode 100644
index 0000000..8af9b06
--- /dev/null
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/PipIrrMwRtuApplication.java
@@ -0,0 +1,63 @@
+package com.dy.rtuMw;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+@EnableScheduling
+@SpringBootApplication
+@EnableAspectJAutoProxy
+@ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.rtuMw"},
+ excludeFilters = {
+ @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {
+ com.dy.common.apiDoc.SpringApiConfig.class
+ }),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = {
+ //浠ヤ笅鍐欐鍒欒〃杈惧紡锛岄渶瑕佸鐩爣绫荤殑瀹屽叏闄愬畾鍚嶅畬鍏ㄥ尮閰嶏紝鍚﹀垯涓嶇敓鏁�
+ "com.dy.common.multiDataSource..*"
+ })
+ }
+)
+@MapperScan(basePackages={"com.dy.pipIrrGlobal"})
+public class PipIrrMwRtuApplication implements CommandLineRunner {
+
+ public static void main(String[] args) {
+ SpringApplication.run(PipIrrMwRtuApplication.class, args);
+ }
+
+ /**
+ * Spring瀹瑰櫒鍚姩瀹屾垚鍚庯紝鎵ц涓嬮潰鏂规硶
+ * @param args 鍙傛暟
+ * @throws Exception 寮傚父
+ */
+ @Override
+ public void run(String... args) throws Exception {
+ try{
+ //绛夊緟鏁版嵁搴撳垵濮嬪寲瀹屾垚
+ Thread.sleep(1000L);
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ finally {
+ this.startMwSv() ;
+ }
+ }
+
+ private void startMwSv(){
+ if(sv != null){
+ sv.startServer();
+ }
+ }
+ private Server sv ;
+
+ @Autowired
+ public void setSv(Server sv){
+ this.sv = sv ;
+ }
+}
--
Gitblit v1.8.0