I\'m making new Spring Boot app and want to be able to store and serve images, I want images to be stored in applications directory:
this is what uploading look
To access image from your images folder,
You need to override addResourceHandlers method of WebMvcConfigurerAdapter class like this:
@Configuration
public class ResourceConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/images/**").addResourceLocations("file:images/");
}
}
After that you need add / before images in URL like this: