diff --git a/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java b/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java index a94c1fe2cb..b2e1aa6cdc 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -48,7 +48,7 @@ import org.springframework.util.ReflectionUtils; * also necessary for loading EhCache configuration from a non-default config location. * *

Note: As of Spring 3.0, Spring's EhCache support requires EhCache 1.3 or higher. - * As of Spring 3.2, we recommend using EhCache 2.1 or higher. + * As of Spring 3.2, we recommend using EhCache 2.5 or higher. * * @author Dmitriy Kopylenko * @author Juergen Hoeller @@ -106,7 +106,7 @@ public class EhCacheManagerFactoryBean implements FactoryBean, Ini } - public void afterPropertiesSet() throws IOException, CacheException { + public void afterPropertiesSet() throws CacheException, IOException { logger.info("Initializing EhCache CacheManager"); InputStream is = (this.configLocation != null ? this.configLocation.getInputStream() : null); try { diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java index 6d0c958c13..d650e6c383 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java @@ -146,7 +146,7 @@ public abstract class SchedulerAccessor implements ResourceLoaderAware { */ public void setJobDetails(JobDetail... jobDetails) { // Use modifiable ArrayList here, to allow for further adding of - // JobDetail objects during autodetection of JobDetailAwareTriggers. + // JobDetail objects during autodetection of JobDetail-aware Triggers. this.jobDetails = new ArrayList(Arrays.asList(jobDetails)); } diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java index 6f35144765..9396759c0c 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java @@ -470,7 +470,6 @@ public class SchedulerFactoryBean extends SchedulerAccessor implements FactoryBe configTimeNonTransactionalDataSourceHolder.set(this.nonTransactionalDataSource); } - // Get Scheduler instance from SchedulerFactory. try { this.scheduler = createScheduler(schedulerFactory, this.schedulerName); diff --git a/spring-context/src/main/java/org/springframework/cache/support/AbstractCacheManager.java b/spring-context/src/main/java/org/springframework/cache/support/AbstractCacheManager.java index 29a5a98973..a6b2064dc4 100644 --- a/spring-context/src/main/java/org/springframework/cache/support/AbstractCacheManager.java +++ b/spring-context/src/main/java/org/springframework/cache/support/AbstractCacheManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -45,12 +45,11 @@ public abstract class AbstractCacheManager implements CacheManager, Initializing public void afterPropertiesSet() { Collection caches = loadCaches(); - // preserve the initial order of the cache names + // Preserve the initial order of the cache names this.cacheMap.clear(); this.cacheNames.clear(); for (Cache cache : caches) { - this.cacheMap.put(cache.getName(), decorateCache(cache)); - this.cacheNames.add(cache.getName()); + addCache(cache); } } @@ -80,8 +79,9 @@ public abstract class AbstractCacheManager implements CacheManager, Initializing /** - * Load the caches for this cache manager. Occurs at startup. - * The returned collection must not be null. + * Load the initial caches for this cache manager. + *

Called by {@link #afterPropertiesSet()} on startup. + * The returned collection may be empty but must not be {@code null}. */ protected abstract Collection loadCaches(); diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java index d833609499..26fcec4b93 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java @@ -172,24 +172,24 @@ class ConfigurationClassParser { * @return annotation metadata of superclass, {@code null} if none found or previously processed */ protected AnnotationMetadata doProcessConfigurationClass(ConfigurationClass configClass, AnnotationMetadata metadata) throws IOException { - // recursively process any member (nested) classes first + // Recursively process any member (nested) classes first processMemberClasses(metadata); - // process any @PropertySource annotations + // Process any @PropertySource annotations AnnotationAttributes propertySource = MetadataUtils.attributesFor(metadata, org.springframework.context.annotation.PropertySource.class); if (propertySource != null) { processPropertySource(propertySource); } - // process any @ComponentScan annotations + // Process any @ComponentScan annotations AnnotationAttributes componentScan = MetadataUtils.attributesFor(metadata, ComponentScan.class); if (componentScan != null) { - // the config class is annotated with @ComponentScan -> perform the scan immediately + // The config class is annotated with @ComponentScan -> perform the scan immediately Set scannedBeanDefinitions = this.componentScanParser.parse(componentScan, metadata.getClassName()); - // check the set of scanned definitions for any further config classes and parse recursively if necessary + // Check the set of scanned definitions for any further config classes and parse recursively if necessary for (BeanDefinitionHolder holder : scannedBeanDefinitions) { if (ConfigurationClassUtils.checkConfigurationClassCandidate(holder.getBeanDefinition(), this.metadataReaderFactory)) { this.parse(holder.getBeanDefinition().getBeanClassName(), holder.getBeanName()); @@ -197,7 +197,7 @@ class ConfigurationClassParser { } } - // process any @Import annotations + // Process any @Import annotations Set imports = new LinkedHashSet(); Set visited = new LinkedHashSet(); collectImports(metadata, imports, visited); @@ -205,7 +205,7 @@ class ConfigurationClassParser { processImport(configClass, metadata, imports, true); } - // process any @ImportResource annotations + // Process any @ImportResource annotations if (metadata.isAnnotated(ImportResource.class.getName())) { AnnotationAttributes importResource = MetadataUtils.attributesFor(metadata, ImportResource.class); String[] resources = importResource.getStringArray("value"); @@ -216,13 +216,13 @@ class ConfigurationClassParser { } } - // process individual @Bean methods + // Process individual @Bean methods Set beanMethods = metadata.getAnnotatedMethods(Bean.class.getName()); for (MethodMetadata methodMetadata : beanMethods) { configClass.addBeanMethod(new BeanMethod(methodMetadata, configClass)); } - // process superclass, if any + // Process superclass, if any if (metadata.hasSuperClass()) { String superclass = metadata.getSuperClassName(); if (!superclass.startsWith("java") && !this.knownSuperclasses.containsKey(superclass)) { @@ -239,7 +239,7 @@ class ConfigurationClassParser { } } - // no superclass, processing is complete + // No superclass -> processing is complete return null; } diff --git a/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java b/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java index 1e68ba23d8..fb9508390e 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -66,7 +66,7 @@ public abstract class PropertiesLoaderSupport { * Set local properties, e.g. via the "props" tag in XML bean definitions, * allowing for merging multiple properties sets into one. */ - public void setPropertiesArray(Properties[] propertiesArray) { + public void setPropertiesArray(Properties... propertiesArray) { this.localProperties = propertiesArray; } @@ -88,7 +88,7 @@ public abstract class PropertiesLoaderSupport { * Hence, make sure that the most specific files are the last * ones in the given list of locations. */ - public void setLocations(Resource[] locations) { + public void setLocations(Resource... locations) { this.locations = locations; } diff --git a/spring-web/src/main/java/org/springframework/http/ResponseEntity.java b/spring-web/src/main/java/org/springframework/http/ResponseEntity.java index 56fa4c1ba5..e4451aec28 100644 --- a/spring-web/src/main/java/org/springframework/http/ResponseEntity.java +++ b/spring-web/src/main/java/org/springframework/http/ResponseEntity.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 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. @@ -21,15 +21,19 @@ import org.springframework.util.ObjectUtils; /** * Extension of {@link HttpEntity} that adds a {@link HttpStatus} status code. + * Used in {@code RestTemplate} as well {@code @Controller} methods. * - *

Returned by {@link org.springframework.web.client.RestTemplate#getForEntity}: + *

In {@code RestTemplate}, this class is returned by + * {@link org.springframework.web.client.RestTemplate#getForEntity getForEntity()} and + * {@link org.springframework.web.client.RestTemplate#exchange exchange()}: *

  * ResponseEntity<String> entity = template.getForEntity("http://example.com", String.class);
  * String body = entity.getBody();
  * MediaType contentType = entity.getHeaders().getContentType();
  * HttpStatus statusCode = entity.getStatusCode();
  * 
- *

Can also be used in Spring MVC, as a return value from a @Controller method: + * + *

Can also be used in Spring MVC, as the return value from a @Controller method: *

  * @RequestMapping("/handle")
  * public ResponseEntity<String> handle() {
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java
index 4cb05bc81e..daddf16615 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java
@@ -58,16 +58,15 @@ public final class FlashMap extends HashMap implements Comparabl
 
 	/**
 	 * Provide a URL path to help identify the target request for this FlashMap.
-	 * The path may be absolute (e.g. /application/resource) or relative to the
-	 * current request (e.g. ../resource).
-	 * @param path the URI path
+	 * 

The path may be absolute (e.g. "/application/resource") or relative to the + * current request (e.g. "../resource"). */ public void setTargetRequestPath(String path) { this.targetRequestPath = path; } /** - * Return the target URL path or {@code null}. + * Return the target URL path (or {@code null} if none specified). */ public String getTargetRequestPath() { return this.targetRequestPath; @@ -75,7 +74,7 @@ public final class FlashMap extends HashMap implements Comparabl /** * Provide request parameters identifying the request for this FlashMap. - * @param params a Map with the names and values of expected parameters. + * @param params a Map with the names and values of expected parameters */ public FlashMap addTargetRequestParams(MultiValueMap params) { if (params != null) { @@ -90,8 +89,8 @@ public final class FlashMap extends HashMap implements Comparabl /** * Provide a request parameter identifying the request for this FlashMap. - * @param name the expected parameter name, skipped if empty or {@code null} - * @param value the expected value, skipped if empty or {@code null} + * @param name the expected parameter name (skipped if empty or {@code null}) + * @param value the expected value (skipped if empty or {@code null}) */ public FlashMap addTargetRequestParam(String name, String value) { if (StringUtils.hasText(name) && StringUtils.hasText(value)) { @@ -117,18 +116,15 @@ public final class FlashMap extends HashMap implements Comparabl } /** - * Whether this instance has expired depending on the amount of elapsed - * time since the call to {@link #startExpirationPeriod}. + * Return whether this instance has expired depending on the amount of + * elapsed time since the call to {@link #startExpirationPeriod}. */ public boolean isExpired() { - if (this.expirationStartTime != 0) { - return (System.currentTimeMillis() - this.expirationStartTime > this.timeToLive * 1000); - } - else { - return false; - } + return (this.expirationStartTime != 0 && + (System.currentTimeMillis() - this.expirationStartTime > this.timeToLive * 1000)); } + /** * Compare two FlashMaps and prefer the one that specifies a target URL * path or has more target URL parameters. Before comparing FlashMap