I have a Spring boot application that uses Thymeleaf as a template engine, I added a default controller that should redirects to Home page when deploying on server, Controller code snippet below:
@Controller
public class HomeController
{
@RequestMapping("/")
public String index()
{
return "index";
}
}
The index is resolved by ViewResolver to the matching web page.
When deploying the generated war "app.war" on a standalone Tomcat instance, the application works just fine and I am being redirected to the Home page (localhost:XXX/context_path/index), "localhost:XXX/<context_path>" also redirects to the correct page.
When deploying on Weblogic, I get an error when I try to access the URL: "localhost:XXX/context_path" and it works when I manually add "/".
I found this tutorial https://o7planning.org/en/11245/deploying-spring-mvc-on-oracle-weblogic-server that suggests adding / to weblogic.xml file which works just fine.
However, when forcing the context-root to "/", the home page URL for the application deployed on weblogic is no longer the same ("localhost:XXX/index" instead of "localhost:XXX/war_name/index").
To sum up, Tomcat adds automatically the "/" to the context root without configuring a context-root.
How can I get the same behaviour with weblogic without having to configure context-root on weblogic.xml?
I am using a weblogic Server 12c.