feat:Application异常结束退出

This commit is contained in:
nieziyan 2024-06-19 16:33:55 +08:00
parent cf0751109d
commit 8b40646076
7 changed files with 91 additions and 7 deletions

View File

@ -31,7 +31,19 @@ public class JeecgAbnormalAlarmApplication extends SpringBootServletInitializer
}
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application = SpringApplication.run(JeecgAbnormalAlarmApplication.class, args);
int exitCode = 1;
ConfigurableApplicationContext application = null;
try {
application = SpringApplication.run(JeecgAbnormalAlarmApplication.class, args);
} catch (Exception e) {
if (null != application) {
application.close();
exitCode = SpringApplication.exit(application, () -> 0);
}
System.exit(exitCode);
}
// ConfigurableApplicationContext application = SpringApplication.run(JeecgAbnormalAlarmApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -53,7 +53,19 @@ public class JeecgAutoProcessApplication extends SpringBootServletInitializer im
}
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application = SpringApplication.run(JeecgAutoProcessApplication.class, args);
int exitCode = 1;
ConfigurableApplicationContext application = null;
try {
application = SpringApplication.run(JeecgAutoProcessApplication.class, args);
} catch (Exception e) {
if (null != application) {
application.close();
exitCode = SpringApplication.exit(application, () -> 0);
}
System.exit(exitCode);
}
// ConfigurableApplicationContext application = SpringApplication.run(JeecgAutoProcessApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -27,7 +27,19 @@ public class JeecgLogManageApplication extends SpringBootServletInitializer impl
}
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application = SpringApplication.run(JeecgLogManageApplication.class, args);
int exitCode = 1;
ConfigurableApplicationContext application = null;
try {
application = SpringApplication.run(JeecgLogManageApplication.class, args);
} catch (Exception e) {
if (null != application) {
application.close();
exitCode = SpringApplication.exit(application, () -> 0);
}
System.exit(exitCode);
}
// ConfigurableApplicationContext application = SpringApplication.run(JeecgLogManageApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -52,7 +52,19 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
}
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application = SpringApplication.run(JeecgSpectrumAnalysisApplication.class, args);
int exitCode = 1;
ConfigurableApplicationContext application = null;
try {
application = SpringApplication.run(JeecgSpectrumAnalysisApplication.class, args);
} catch (Exception e) {
if (null != application) {
application.close();
exitCode = SpringApplication.exit(application, () -> 0);
}
System.exit(exitCode);
}
// ConfigurableApplicationContext application = SpringApplication.run(JeecgSpectrumAnalysisApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -5,6 +5,7 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.service.ISysUserFocusStationService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@ -35,7 +36,19 @@ public class JeecgStationOperationApplication extends SpringBootServletInitializ
}
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application = SpringApplication.run(JeecgStationOperationApplication.class, args);
int exitCode = 1;
ConfigurableApplicationContext application = null;
try {
application = SpringApplication.run(JeecgStationOperationApplication.class, args);
} catch (Exception e) {
if (null != application) {
application.close();
exitCode = SpringApplication.exit(application, () -> 0);
}
System.exit(exitCode);
}
//ConfigurableApplicationContext application = SpringApplication.run(JeecgStationOperationApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -52,7 +52,18 @@ public class JeecgSystemCloudApplication extends SpringBootServletInitializer im
}
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application = SpringApplication.run(JeecgSystemCloudApplication.class, args);
int exitCode = 1;
ConfigurableApplicationContext application = null;
try {
application = SpringApplication.run(JeecgSystemCloudApplication.class, args);
} catch (Exception e) {
if (null != application) {
application.close();
exitCode = SpringApplication.exit(application, () -> 0);
}
System.exit(exitCode);
}
// ConfigurableApplicationContext application = SpringApplication.run(JeecgSystemCloudApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");

View File

@ -26,7 +26,19 @@ public class JeecgWebStatisticsApplication extends SpringBootServletInitializer
}
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application = SpringApplication.run(JeecgWebStatisticsApplication.class, args);
int exitCode = 1;
ConfigurableApplicationContext application = null;
try {
application = SpringApplication.run(JeecgWebStatisticsApplication.class, args);
} catch (Exception e) {
if (null != application) {
application.close();
exitCode = SpringApplication.exit(application, () -> 0);
}
System.exit(exitCode);
}
// ConfigurableApplicationContext application = SpringApplication.run(JeecgWebStatisticsApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");