I wanted to upload dynamic images and serve them using <img> tag, so I followed this solution: Spring Boot images uploading and serving
Absolute path of project: /home/vkumar/apps/contest
Absolute path of upload dir: /home/vkumar/apps/contest/uploads
ResourceConfig.java
public class ResourceConfig implements WebMvcConfigurer { @Override public void addResourceHandlers(final ResourceHandlerRegistry registry) { registry.addResourceHandler("/uploads/**").addResourceLocations("file:uploads/"); } } Then I uploaded a file in uploads dir test.jpg
Now If I go to the server and run the app using the command
mvn spring-boot:run
and open image http://example.com:8080/uploads/test.jpg
all work fine, I can see an image which been uploaded however If I create jar using the command
mvn clean package
I see the error "This application has no explicit mapping for /error, so you are seeing this as a fallback."