Skip to content

Commit 7b6e1c9

Browse files
committed
Merge branch '5.2.x'
2 parents 1f35cc5 + 9bf5cba commit 7b6e1c9

File tree

3 files changed

+20
-28
lines changed

3 files changed

+20
-28
lines changed

spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectJAdvisorsBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -97,7 +97,7 @@ public List<Advisor> buildAspectJAdvisors() {
9797
}
9898
// We must be careful not to instantiate beans eagerly as in this case they
9999
// would be cached by the Spring container but would not have been weaved.
100-
Class<?> beanType = this.beanFactory.getType(beanName);
100+
Class<?> beanType = this.beanFactory.getType(beanName, false);
101101
if (beanType == null) {
102102
continue;
103103
}

spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,21 +1670,22 @@ protected boolean isFactoryBean(String beanName, RootBeanDefinition mbd) {
16701670
/**
16711671
* Determine the bean type for the given FactoryBean definition, as far as possible.
16721672
* Only called if there is no singleton instance registered for the target bean
1673-
* already. Implementations are only allowed to instantiate the factory bean if
1674-
* {@code allowInit} is {@code true}, otherwise they should try to determine the
1675-
* result through other means.
1673+
* already. The implementation is allowed to instantiate the target factory bean if
1674+
* {@code allowInit} is {@code true} and the type cannot be determined another way;
1675+
* otherwise it is restricted to introspecting signatures and related metadata.
16761676
* <p>If no {@link FactoryBean#OBJECT_TYPE_ATTRIBUTE} if set on the bean definition
16771677
* and {@code allowInit} is {@code true}, the default implementation will create
16781678
* the FactoryBean via {@code getBean} to call its {@code getObjectType} method.
16791679
* Subclasses are encouraged to optimize this, typically by inspecting the generic
1680-
* signature of the factory bean class or the factory method that creates it. If
1681-
* subclasses do instantiate the FactoryBean, they should consider trying the
1682-
* {@code getObjectType} method without fully populating the bean. If this fails, a
1683-
* full FactoryBean creation as performed by this implementation should be used as
1684-
* fallback.
1680+
* signature of the factory bean class or the factory method that creates it.
1681+
* If subclasses do instantiate the FactoryBean, they should consider trying the
1682+
* {@code getObjectType} method without fully populating the bean. If this fails,
1683+
* a full FactoryBean creation as performed by this implementation should be used
1684+
* as fallback.
16851685
* @param beanName the name of the bean
16861686
* @param mbd the merged bean definition for the bean
1687-
* @param allowInit if initialization of the FactoryBean is permitted
1687+
* @param allowInit if initialization of the FactoryBean is permitted if the type
1688+
* cannot be determined another way
16881689
* @return the type for the bean if determinable, otherwise {@code ResolvableType.NONE}
16891690
* @since 5.2
16901691
* @see org.springframework.beans.factory.FactoryBean#getObjectType()
@@ -1700,7 +1701,7 @@ protected ResolvableType getTypeForFactoryBean(String beanName, RootBeanDefiniti
17001701
try {
17011702
FactoryBean<?> factoryBean = doGetBean(FACTORY_BEAN_PREFIX + beanName, FactoryBean.class, null, true);
17021703
Class<?> objectType = getTypeForFactoryBean(factoryBean);
1703-
return (objectType != null) ? ResolvableType.forClass(objectType) : ResolvableType.NONE;
1704+
return (objectType != null ? ResolvableType.forClass(objectType) : ResolvableType.NONE);
17041705
}
17051706
catch (BeanCreationException ex) {
17061707
if (ex.contains(BeanCurrentlyInCreationException.class)) {

spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -67,8 +67,6 @@
6767
* @see PutMapping
6868
* @see DeleteMapping
6969
* @see PatchMapping
70-
* @see org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
71-
* @see org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter
7270
*/
7371
@Target({ElementType.TYPE, ElementType.METHOD})
7472
@Retention(RetentionPolicy.RUNTIME)
@@ -120,9 +118,8 @@
120118
* The HTTP request methods to map to, narrowing the primary mapping:
121119
* GET, POST, HEAD, OPTIONS, PUT, PATCH, DELETE, TRACE.
122120
* <p><b>Supported at the type level as well as at the method level!</b>
123-
* When used at the type level, all method-level mappings inherit
124-
* this HTTP method restriction (i.e. the type-level restriction
125-
* gets checked before the handler method is even resolved).
121+
* When used at the type level, all method-level mappings inherit this
122+
* HTTP method restriction.
126123
*/
127124
RequestMethod[] method() default {};
128125

@@ -136,13 +133,8 @@
136133
* any value). Finally, "!myParam" style expressions indicate that the
137134
* specified parameter is <i>not</i> supposed to be present in the request.
138135
* <p><b>Supported at the type level as well as at the method level!</b>
139-
* When used at the type level, all method-level mappings inherit
140-
* this parameter restriction (i.e. the type-level restriction
141-
* gets checked before the handler method is even resolved).
142-
* <p>Parameter mappings are considered as restrictions that are enforced at
143-
* the type level. The primary path mapping (i.e. the specified URI value)
144-
* still has to uniquely identify the target handler, with parameter mappings
145-
* simply expressing preconditions for invoking the handler.
136+
* When used at the type level, all method-level mappings inherit this
137+
* parameter restriction.
146138
*/
147139
String[] params() default {};
148140

@@ -162,9 +154,8 @@
162154
* </pre>
163155
* will match requests with a Content-Type of "text/html", "text/plain", etc.
164156
* <p><b>Supported at the type level as well as at the method level!</b>
165-
* When used at the type level, all method-level mappings inherit
166-
* this header restriction (i.e. the type-level restriction
167-
* gets checked before the handler method is even resolved).
157+
* When used at the type level, all method-level mappings inherit this
158+
* header restriction.
168159
* @see org.springframework.http.MediaType
169160
*/
170161
String[] headers() default {};

0 commit comments

Comments
 (0)