Browse Source

Polishing

pull/26658/head
Juergen Hoeller 5 years ago
parent
commit
530fb0808d
  1. 6
      spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java
  2. 6
      spring-core/src/main/java/org/springframework/util/StringUtils.java
  3. 2
      spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceUrlProvider.java
  4. 4
      spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceUrlProvider.java

6
spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -489,8 +489,8 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp @@ -489,8 +489,8 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
resolveConstructorArguments(args, 2, hasClosureArgument ? args.length - 1 : args.length);
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName, (Class<?>) args[1], constructorArgs);
Map<?, ?> namedArgs = (Map<?, ?>) args[0];
for (Object o : namedArgs.keySet()) {
String propName = (String) o;
for (Object key : namedArgs.keySet()) {
String propName = (String) key;
setProperty(propName, namedArgs.get(propName));
}
}

6
spring-core/src/main/java/org/springframework/util/StringUtils.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -1342,8 +1342,8 @@ public abstract class StringUtils { @@ -1342,8 +1342,8 @@ public abstract class StringUtils {
}
StringJoiner sj = new StringJoiner(delim);
for (Object o : arr) {
sj.add(String.valueOf(o));
for (Object elem : arr) {
sj.add(String.valueOf(elem));
}
return sj.toString();
}

2
spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceUrlProvider.java

@ -57,12 +57,12 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed @@ -57,12 +57,12 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
private static final Log logger = LogFactory.getLog(ResourceUrlProvider.class);
private final Map<PathPattern, ResourceWebHandler> handlerMap = new LinkedHashMap<>();
@Nullable
private ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;

4
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceUrlProvider.java

@ -67,6 +67,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed @@ -67,6 +67,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
private boolean autodetect = true;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
@ -134,6 +135,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed @@ -134,6 +135,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
return this.autodetect;
}
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if (event.getApplicationContext() == this.applicationContext && isAutodetect()) {
@ -145,7 +147,6 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed @@ -145,7 +147,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());
@ -225,7 +226,6 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed @@ -225,7 +226,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 {

Loading…
Cancel
Save