2

I know how to set context path in WAR project. Create a context.xml file in META-INF folder and add the below lines

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/my-project-path"/>

But i don't know how to set in JAR projects without context.xml file. I had tried the following methods, but not working

1) server.servlet.context-path=/my-project-path in application.properties
2) System.setProperty("server.servlet.context-path", "/my-project-path");

EDIT

server.servlet.context-path=/my-project-path is working in netbeans embeded Tomcat.

But not working in jboss/wildfly

lkatiforis
  • 5,703
  • 2
  • 16
  • 35
Pamba
  • 776
  • 1
  • 16
  • 29

1 Answers1

4

All of the server.* properties that Spring Boot supports only apply to the configuration of the embedded servlet container (Tomcat).

Jboss wildfly

Add your jboss-web.xml file in this directory : /src/main/webapp/WEB-INF

Content:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
        <context-root>/</context-root>
</jboss-web>
lkatiforis
  • 5,703
  • 2
  • 16
  • 35