Skip to content

Commit a45bce1

Browse files
committed
Polishing
1 parent 8d1499e commit a45bce1

File tree

8 files changed

+32
-29
lines changed

8 files changed

+32
-29
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/BeanFactory.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -181,8 +181,7 @@ public interface BeanFactory {
181181
* but may also be translated into a conventional by-name lookup based on the name
182182
* of the given type. For more extensive retrieval operations across sets of beans,
183183
* use {@link ListableBeanFactory} and/or {@link BeanFactoryUtils}.
184-
* @param requiredType type the bean must match; can be an interface or superclass.
185-
* {@code null} is disallowed.
184+
* @param requiredType type the bean must match; can be an interface or superclass
186185
* @return an instance of the single bean matching the required type
187186
* @throws NoSuchBeanDefinitionException if no bean of the given type was found
188187
* @throws NoUniqueBeanDefinitionException if more than one bean of the given type was found
@@ -200,8 +199,7 @@ public interface BeanFactory {
200199
* but may also be translated into a conventional by-name lookup based on the name
201200
* of the given type. For more extensive retrieval operations across sets of beans,
202201
* use {@link ListableBeanFactory} and/or {@link BeanFactoryUtils}.
203-
* @param requiredType type the bean must match; can be an interface or superclass.
204-
* {@code null} is disallowed.
202+
* @param requiredType type the bean must match; can be an interface or superclass
205203
* @param args arguments to use when creating a bean instance using explicit arguments
206204
* (only applied when creating a new instance as opposed to retrieving an existing one)
207205
* @return an instance of the bean

spring-beans/src/main/java/org/springframework/beans/factory/annotation/BeanFactoryAnnotationUtils.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,11 +22,11 @@
2222
import org.springframework.beans.BeansException;
2323
import org.springframework.beans.factory.BeanFactory;
2424
import org.springframework.beans.factory.BeanFactoryUtils;
25+
import org.springframework.beans.factory.ListableBeanFactory;
2526
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
2627
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
2728
import org.springframework.beans.factory.config.BeanDefinition;
2829
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
29-
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
3030
import org.springframework.beans.factory.support.AbstractBeanDefinition;
3131
import org.springframework.beans.factory.support.AutowireCandidateQualifier;
3232
import org.springframework.beans.factory.support.RootBeanDefinition;
@@ -35,8 +35,8 @@
3535
import org.springframework.util.Assert;
3636

3737
/**
38-
* Convenience methods performing bean lookups related to annotations, for example
39-
* Spring's {@link Qualifier @Qualifier} annotation.
38+
* Convenience methods performing bean lookups related to Spring-specific annotations,
39+
* for example Spring's {@link Qualifier @Qualifier} annotation.
4040
*
4141
* @author Juergen Hoeller
4242
* @author Chris Beams
@@ -49,23 +49,23 @@ public abstract class BeanFactoryAnnotationUtils {
4949
* Obtain a bean of type {@code T} from the given {@code BeanFactory} declaring a
5050
* qualifier (e.g. via {@code <qualifier>} or {@code @Qualifier}) matching the given
5151
* qualifier, or having a bean name matching the given qualifier.
52-
* @param beanFactory the BeanFactory to get the target bean from
52+
* @param beanFactory the factory to get the target bean from (also searching ancestors)
5353
* @param beanType the type of bean to retrieve
5454
* @param qualifier the qualifier for selecting between multiple bean matches
5555
* @return the matching bean of type {@code T} (never {@code null})
5656
* @throws NoUniqueBeanDefinitionException if multiple matching beans of type {@code T} found
5757
* @throws NoSuchBeanDefinitionException if no matching bean of type {@code T} found
5858
* @throws BeansException if the bean could not be created
59-
* @see BeanFactory#getBean(Class)
59+
* @see BeanFactoryUtils#beanOfTypeIncludingAncestors(ListableBeanFactory, Class)
6060
*/
6161
public static <T> T qualifiedBeanOfType(BeanFactory beanFactory, Class<T> beanType, String qualifier)
6262
throws BeansException {
6363

6464
Assert.notNull(beanFactory, "BeanFactory must not be null");
6565

66-
if (beanFactory instanceof ConfigurableListableBeanFactory) {
66+
if (beanFactory instanceof ListableBeanFactory) {
6767
// Full qualifier matching supported.
68-
return qualifiedBeanOfType((ConfigurableListableBeanFactory) beanFactory, beanType, qualifier);
68+
return qualifiedBeanOfType((ListableBeanFactory) beanFactory, beanType, qualifier);
6969
}
7070
else if (beanFactory.containsBean(qualifier)) {
7171
// Fallback: target bean at least found by bean name.
@@ -82,12 +82,12 @@ else if (beanFactory.containsBean(qualifier)) {
8282
/**
8383
* Obtain a bean of type {@code T} from the given {@code BeanFactory} declaring a qualifier
8484
* (e.g. {@code <qualifier>} or {@code @Qualifier}) matching the given qualifier).
85-
* @param bf the BeanFactory to get the target bean from
85+
* @param bf the factory to get the target bean from
8686
* @param beanType the type of bean to retrieve
8787
* @param qualifier the qualifier for selecting between multiple bean matches
8888
* @return the matching bean of type {@code T} (never {@code null})
8989
*/
90-
private static <T> T qualifiedBeanOfType(ConfigurableListableBeanFactory bf, Class<T> beanType, String qualifier) {
90+
private static <T> T qualifiedBeanOfType(ListableBeanFactory bf, Class<T> beanType, String qualifier) {
9191
String[] candidateBeans = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(bf, beanType);
9292
String matchingBean = null;
9393
for (String beanName : candidateBeans) {
@@ -115,14 +115,14 @@ else if (bf.containsBean(qualifier)) {
115115
* Check whether the named bean declares a qualifier of the given name.
116116
* @param qualifier the qualifier to match
117117
* @param beanName the name of the candidate bean
118-
* @param beanFactory the {@code BeanFactory} from which to retrieve the named bean
118+
* @param beanFactory the factory from which to retrieve the named bean
119119
* @return {@code true} if either the bean definition (in the XML case)
120120
* or the bean's factory method (in the {@code @Bean} case) defines a matching
121121
* qualifier value (through {@code <qualifier>} or {@code @Qualifier})
122122
* @since 5.0
123123
*/
124-
public static boolean isQualifierMatch(Predicate<String> qualifier, String beanName,
125-
@Nullable BeanFactory beanFactory) {
124+
public static boolean isQualifierMatch(
125+
Predicate<String> qualifier, String beanName, @Nullable BeanFactory beanFactory) {
126126

127127
// Try quick bean name or alias match first...
128128
if (qualifier.test(beanName)) {

spring-core/src/main/java/org/springframework/core/io/PathResource.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
* @author Philippe Marschall
4343
* @author Juergen Hoeller
4444
* @since 4.0
45-
* @see FileSystemResource
4645
* @see java.nio.file.Path
4746
* @see java.nio.file.Files
47+
* @see FileSystemResource
4848
*/
4949
public class PathResource extends AbstractResource implements WritableResource {
5050

@@ -81,8 +81,8 @@ public PathResource(String path) {
8181
* <p>Note: Unlike {@link FileSystemResource}, when building relative resources
8282
* via {@link #createRelative}, the relative path will be built <i>underneath</i>
8383
* the given root: e.g. Paths.get("C:/dir1/"), relative path "dir2" -> "C:/dir1/dir2"!
84-
* @see java.nio.file.Paths#get(URI)
8584
* @param uri a path URI
85+
* @see java.nio.file.Paths#get(URI)
8686
*/
8787
public PathResource(URI uri) {
8888
Assert.notNull(uri, "URI must not be null");
@@ -99,7 +99,7 @@ public final String getPath() {
9999

100100
/**
101101
* This implementation returns whether the underlying file exists.
102-
* @see org.springframework.core.io.PathResource#exists()
102+
* @see java.nio.file.Files#exists(Path, java.nio.file.LinkOption...)
103103
*/
104104
@Override
105105
public boolean exists() {

spring-core/src/main/java/org/springframework/core/io/Resource.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,9 +43,9 @@
4343
* @see WritableResource
4444
* @see ContextResource
4545
* @see UrlResource
46-
* @see ClassPathResource
46+
* @see FileUrlResource
4747
* @see FileSystemResource
48-
* @see PathResource
48+
* @see ClassPathResource
4949
* @see ByteArrayResource
5050
* @see InputStreamResource
5151
*/

spring-core/src/main/java/org/springframework/core/type/classreading/AbstractRecursiveAnnotationVisitor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,6 +31,8 @@
3131
import org.springframework.util.ReflectionUtils;
3232

3333
/**
34+
* {@link AnnotationVisitor} to recursively visit annotations.
35+
*
3436
* @author Chris Beams
3537
* @author Juergen Hoeller
3638
* @author Phillip Webb

spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
8484
}
8585

8686
@Override
87-
public AnnotationVisitor visitAnnotation(final String desc, boolean visible) {
87+
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
8888
String className = Type.getType(desc).getClassName();
8989
this.annotationSet.add(className);
9090
return new AnnotationAttributesReadingVisitor(

spring-core/src/main/java/org/springframework/core/type/classreading/RecursiveAnnotationAttributesVisitor.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,11 +16,14 @@
1616

1717
package org.springframework.core.type.classreading;
1818

19+
import org.springframework.asm.AnnotationVisitor;
1920
import org.springframework.core.annotation.AnnotationAttributes;
2021
import org.springframework.core.annotation.AnnotationUtils;
2122
import org.springframework.lang.Nullable;
2223

2324
/**
25+
* {@link AnnotationVisitor} to recursively visit annotation attributes.
26+
*
2427
* @author Chris Beams
2528
* @author Juergen Hoeller
2629
* @since 3.1.1

src/docs/asciidoc/web/webmvc.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,13 +1380,13 @@ and security (see next section for more details).
13801380
To completely disable the use of file extensions, you must set both of these:
13811381

13821382
* `useSuffixPatternMatching(false)`, see <<mvc-config-path-matching,PathMatchConfigurer>>
1383-
* `favorPathExtension(false)`, see <<mvc-config-content-negotiation,ContentNeogiationConfigurer>>
1383+
* `favorPathExtension(false)`, see <<mvc-config-content-negotiation,ContentNegotiationConfigurer>>
13841384

13851385
URL-based content negotiation can still be useful, for example when typing a URL in a
13861386
browser. To enable that we recommend a query parameter based strategy to avoid most of
13871387
the issues that come with file extensions. Or if you must use file extensions, consider
13881388
restricting them to a list of explicitly registered extensions through the
1389-
`mediaTypes` property of <<mvc-config-content-negotiation,ContentNeogiationConfigurer>>.
1389+
`mediaTypes` property of <<mvc-config-content-negotiation,ContentNegotiationConfigurer>>.
13901390

13911391

13921392
[[mvc-ann-requestmapping-rfd]]

0 commit comments

Comments
 (0)