I am having a Spring Boot application and I would like to change the directory of my frontend. Instead of having the frontend resources inside the directory resources/static
, I would like to move them to another directory out of the resources
. What would be the property I need to change so that my application considers the new directory for rendering the frontend?
Asked
Active
Viewed 184 times
0

luthien
- 1,285
- 3
- 15
- 26
1 Answers
0
You can configure additional resources mapping using WebMvcConfigurerAdapter
:
@Component
public class ResourcesMvcAdapter extends WebMvcConfigurerAdapter {
private final Path resourcePath = Paths.get( ... );
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**")
.addResourceLocations(resourcePath.toUri().toString());
}
}

Karol Dowbecki
- 43,645
- 9
- 78
- 111