Reputation: 51
I have spring-boot application which creates catalog with html static pages. When I start application by command: mvn spring-boot:run
everything works good (folder with static pages is created in /resources/
catalog and client have access to pages) but I want have my app deployed as jar file and here I have my question, how can I achieve my goal? I understand that I can't add dynamically resources to jar but maybe I can create folder with resources next to my jar file and somehow add this folder to public resources so client could have access to html pages.
Upvotes: 3
Views: 5499
Reputation: 116091
Try prefixing you resource location with file:
, for example:
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/external/**")
.addResourceLocations("file:external/");
}
This path is relative to the directory from which you launched the application. You can also use an absolute path, for example file:/path/to/resources
.
Upvotes: 8