Polishing (backported from master)

This commit is contained in:
Juergen Hoeller
2021-03-09 00:05:55 +01:00
parent dd967215fe
commit 0fc831e8bd
6 changed files with 25 additions and 17 deletions

View File

@@ -68,6 +68,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
private boolean autodetect = true;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
@@ -135,6 +136,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
return this.autodetect;
}
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if (event.getApplicationContext() == this.applicationContext && isAutodetect()) {
@@ -146,7 +148,6 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
}
}
protected void detectResourceHandlers(ApplicationContext appContext) {
Map<String, SimpleUrlHandlerMapping> beans = appContext.getBeansOfType(SimpleUrlHandlerMapping.class);
List<SimpleUrlHandlerMapping> mappings = new ArrayList<>(beans.values());
@@ -223,7 +224,6 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
*/
@Nullable
public final String getForLookupPath(String lookupPath) {
// Clean duplicate slashes or pathWithinPattern won't match lookupPath
String previous;
do {