Java SpringBoot Access image outside application

I want to enable my users to upload images which are then stored on the server. Since putting those images inside the applications webapp/content/images would remove them with every new deployment I want to store and access those images outside of my application.

I still need to display the images in my html

[...]      <div class="photo-container">          <label style="align-self: center">              <img *ngIf="user" [src]="user.imageUrl  [...] 

User Model:

export interface IUser { [...]     imageUrl?: string; } export class User implements IUser {     constructor(         [....]         public imageUrl?: string     ){         [....]         this.imageUrl = imageUrl ? imageUrl : null;     } } 

I found the function addResourceHandlers that seems to be able to do exactly this, but I have trouble implementing it.

/**  * Configuration of web application with Servlet 3.0 APIs.  */ @Configuration public class WebConfigurer implements WebMvcConfigurer, ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { [...]     @Override     public void addResourceHandlers(ResourceHandlerRegistry registry) {         registry             .addResourceHandler("/content/images/**")             //for Unix: file:/opt/files             //TODO: use path here             .addResourceLocations("file:///C:/content/images/");     } [...] } 

Can someone tell me what iss wrong ? When I access localhost:8080/content/images/nameOfSomeImage.jpg i have this error Cannot GET /content/images/nameOfSomeImage.jpg