From c9b63cfa5638c4734a00c1f81dcee01a09230618 Mon Sep 17 00:00:00 2001 From: richie Date: Fri, 18 Oct 2019 13:49:58 +0800 Subject: [PATCH] =?UTF-8?q?FineBI=E5=86=85=E7=BD=AEtomcat=E7=9A=84?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 ++++ src/main/java/com/finebi/start/Leaner.java | 38 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .gitignore create mode 100644 src/main/java/com/finebi/start/Leaner.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1bf50a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.iml +.idea/ +/target/ +/download/ +/webroot/ +.DS_Store \ No newline at end of file diff --git a/src/main/java/com/finebi/start/Leaner.java b/src/main/java/com/finebi/start/Leaner.java new file mode 100644 index 0000000..8e57900 --- /dev/null +++ b/src/main/java/com/finebi/start/Leaner.java @@ -0,0 +1,38 @@ +package com.finebi.start; + +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.startup.Tomcat; + +import java.util.HashSet; +import java.util.Set; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019/10/18 + * FineBI启动器 + */ +public class Leaner { + + private static final String APP_NAME = "webroot"; + + public static void main(String... args) throws Exception { + + Tomcat tomcat = new Tomcat(); + tomcat.setPort(8080); + + String docBase = System.getProperty("user.dir") + "/" + APP_NAME; + ProductConstants.setWebAppName(ProductConstants.getAppFolderName()); + String appName = "/" + APP_NAME; + Context context = tomcat.addContext(appName, docBase); + + SpringServletContainerInitializer initializer = new SpringServletContainerInitializer(); + Set> classes = new HashSet<>(); + classes.add(FineWebApplicationInitializer.class); + context.addServletContainerInitializer(initializer, classes); + tomcat.start(); + } +}