forked from fanruan/bi-starter-latest
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.5 KiB
53 lines
1.5 KiB
5 years ago
|
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;
|
||
5 years ago
|
import org.apache.catalina.loader.WebappLoader;
|
||
5 years ago
|
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启动器
|
||
|
*/
|
||
5 years ago
|
public class Learner {
|
||
5 years ago
|
|
||
|
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;
|
||
5 years ago
|
|
||
5 years ago
|
Context context = tomcat.addContext(appName, docBase);
|
||
5 years ago
|
Tomcat.initWebappDefaults(context);
|
||
|
|
||
|
context.setLoader(new TomcatLoader());
|
||
5 years ago
|
|
||
|
SpringServletContainerInitializer initializer = new SpringServletContainerInitializer();
|
||
|
Set<Class<?>> classes = new HashSet<>();
|
||
|
classes.add(FineWebApplicationInitializer.class);
|
||
|
context.addServletContainerInitializer(initializer, classes);
|
||
|
tomcat.start();
|
||
|
}
|
||
5 years ago
|
|
||
|
private static class TomcatLoader extends WebappLoader {
|
||
|
|
||
|
@Override
|
||
|
public ClassLoader getClassLoader() {
|
||
|
|
||
|
return this.getClass().getClassLoader();
|
||
|
}
|
||
|
}
|
||
5 years ago
|
}
|