Reputation: 1504
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.
Upvotes: 1
Views: 528
Reputation: 927
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
}
Upvotes: 1