0

I have a spring mvc application and I am upgrading that to spring 6. The upgrade was successful but having issues with static resources. I have help files in the application and I have mapped /help/** url to /help/. I am using tomcat version 10.1.

<mvc:resources mapping="/help/**" location="/help/" />

When I open URL http://localhost:8080/app/help it shows 404. While using spring 5 it was displaying index.html from the help directory but after upgrading to spring 6 it's not mapping index.html.

If I use http://localhost:8080/app/help/index.html then it opens the page correctly.

Is there any other configuration required in spring 6 that will map index.html in folder/subfolders for static resources?

I have tried mapping *.html to the default servlet.

<servlet-mapping>
  <servlet-name>default</servlet-name>
  <url-pattern>*.html</url-pattern>
</servlet-mapping>

After the above changes in the web.xml file it shows the page correctly at URL http://localhost:8080/app/help But I have also swagger documentation so when I open http://localhost:8080/app/swagger-ui/index.html then it shows 404.

I want http://localhost:8080/app/help to open the help file with index.html and map index.html for subfolders and http://localhost:8080/app/swagger-ui/index.html to open swagger documentation.

Brian Clozel
  • 56,583
  • 15
  • 167
  • 176
Dhaval Gajjar
  • 2,508
  • 1
  • 2
  • 13

0 Answers0