Browse Source

FineBI内置tomcat的启动器

pull/1/head
richie 5 years ago
parent
commit
c9b63cfa56
  1. 6
      .gitignore
  2. 38
      src/main/java/com/finebi/start/Leaner.java

6
.gitignore vendored

@ -0,0 +1,6 @@
*.iml
.idea/
/target/
/download/
/webroot/
.DS_Store

38
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<Class<?>> classes = new HashSet<>();
classes.add(FineWebApplicationInitializer.class);
context.addServletContainerInitializer(initializer, classes);
tomcat.start();
}
}
Loading…
Cancel
Save