回调代码
package com.litongjava.jfinal.spring.xml; import java.util.Set; import javax.servlet.ServletContainerInitializer; import javax.servlet.ServletContext; import javax.servlet.ServletException; import lombok.extern.slf4j.Slf4j; @Slf4j public class SpringServletContainerInitializer implements ServletContainerInitializer { @Override public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException { log.info("回调成功"); } }
启动类
package com.litongjava.jfinal.spring.xml; import com.jfinal.config.Constants; import com.jfinal.config.Handlers; import com.jfinal.config.Interceptors; import com.jfinal.config.JFinalConfig; import com.jfinal.config.Plugins; import com.jfinal.config.Routes; import com.jfinal.server.undertow.UndertowServer; import com.jfinal.template.Engine; public class AppConfig extends JFinalConfig { public static void main(String[] args) { long start = System.currentTimeMillis(); UndertowServer.create(AppConfig.class, "undertow.txt").start(); long end = System.currentTimeMillis(); System.out.println((end - start) + "ms"); } public void configConstant(Constants me) { me.setDevMode(true); } public void configRoute(Routes me) { } public void configEngine(Engine me) { } public void configPlugin(Plugins me) { } public void configInterceptor(Interceptors me) { } public void configHandler(Handlers me) { } }
本来以为UndertowServer启动成功后会回调ServletContainerInitializer 的onStartup但是发现并没有回调成功,
原因是什么?
项目:JFinal