Skip to content

How to set JBoss Wildfly context root with XML-less Spring web application?

Having a Spring application with Maven where all the configuration is done in Java (all configuration previously stored in web.xml is now in annotated @Configuration files or in WebAppInitializer that extends AbstractAnnotationConfigDispatcherServletInitializer), how can I set the context root for my application in JBoss Wildfly? The app has no web.xml, nor jboss-web.xml .

When the app used XML configuration the context root was set in jboss-web.xml like this:




JBoss wildfly defaults the context root to the name of the war file. Setting the name of the war file to the desired value (web context root) in Maven solves the issue:


More detailed answer by @Nikhil Bide can be found here.

User contributions licensed under: CC BY-SA
7 People found this is helpful