We are using a SimpleUrlHandlerMapping
in our Spring Boot 2.1 application to load mapping information from database:
@Bean
public SimpleUrlHandlerMapping simpleUrlHandlerMapping() {
SimpleUrlHandlerMapping simpleUrlHandlerMapping = new SimpleUrlHandlerMapping();
simpleUrlHandlerMapping.setOrder(Ordered.HIGHEST_PRECEDENCE);
simpleUrlHandlerMapping.setInterceptors(requestMonitoringInterceptor);
Map<String, Object> urlMap = getUrlMapFromDb();
simpleUrlHandlerMapping.setUrlMap(urlMap);
return simpleUrlHandlerMapping;
}
It works fine, but if the mapping is changed then we need to restart the server to load the new mapping during startup. The application administrator doesn't have server access so he/she is not able to restart the application.
Is there any way to reload the mapping from the application itself without restarting the server?