From 6fab828534caec4d49b1f61966ba19d07ebb8bec Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 30 Jun 2020 10:57:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=A5=BD=E8=87=AA=E5=8A=A8=E6=89=93=E5=BC=80=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/finebi/start/Learner.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/com/finebi/start/Learner.java b/src/main/java/com/finebi/start/Learner.java index 8db06bf..16e2b10 100644 --- a/src/main/java/com/finebi/start/Learner.java +++ b/src/main/java/com/finebi/start/Learner.java @@ -1,12 +1,16 @@ package com.finebi.start; +import com.fr.log.FineLoggerFactory; import com.fr.stable.ProductConstants; import com.fr.startup.FineWebApplicationInitializer; import com.fr.third.springframework.web.SpringServletContainerInitializer; import org.apache.catalina.Context; +import org.apache.catalina.LifecycleState; import org.apache.catalina.loader.WebappLoader; import org.apache.catalina.startup.Tomcat; +import java.awt.*; +import java.net.URI; import java.util.HashSet; import java.util.Set; @@ -28,6 +32,15 @@ public class Learner { String docBase = System.getProperty("user.dir") + "/" + APP_NAME; ProductConstants.setWebAppName(ProductConstants.getAppFolderName()); String appName = "/" + APP_NAME; + tomcat.getServer().addLifecycleListener(lifecycleEvent -> { + if (LifecycleState.STARTED.equals(lifecycleEvent.getLifecycle().getState())) { + try { + Desktop.getDesktop().browse(new URI("http://localhost:8080/webroot/decision")); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + }); Context context = tomcat.addContext(appName, docBase); Tomcat.initWebappDefaults(context);