You can do this by passing the absolute path to the static resource directory in this method:
externalStaticFileLocation("/var/www/public");
Or by passing the relative path in this method:
staticFileLocation("/public");
Call this before setting any route. Create an index.html file in the root directory of your static resources.
source share