Is there a way to create an application with embedded Tomcat 8 that is configured programmatically (not through a web.xml)? I'm trying to start this application via main() and not through Maven's Tomcat plugin.
I honestly don't quite understand what you're trying to do, but Tomcat 8 supports Servlet spec 3.1. Anything after spec 3.0 (tomcat 7) can implement a ServletContainerInitializer. This should give you what you want.
public class ServletInitializer implements ServletContainerInitializer {
public void onStartup(Set<Class<?>> c, ServletContext cx) {
// register stuff here
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.