Merge branch '5.2.x'
This commit is contained in:
commit
7b6e1c957f
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
|
@ -97,7 +97,7 @@ public class BeanFactoryAspectJAdvisorsBuilder {
|
|||
}
|
||||
// We must be careful not to instantiate beans eagerly as in this case they
|
||||
// would be cached by the Spring container but would not have been weaved.
|
||||
Class<?> beanType = this.beanFactory.getType(beanName);
|
||||
Class<?> beanType = this.beanFactory.getType(beanName, false);
|
||||
if (beanType == null) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1670,21 +1670,22 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
|||
/**
|
||||
* Determine the bean type for the given FactoryBean definition, as far as possible.
|
||||
* Only called if there is no singleton instance registered for the target bean
|
||||
* already. Implementations are only allowed to instantiate the factory bean if
|
||||
* {@code allowInit} is {@code true}, otherwise they should try to determine the
|
||||
* result through other means.
|
||||
* already. The implementation is allowed to instantiate the target factory bean if
|
||||
* {@code allowInit} is {@code true} and the type cannot be determined another way;
|
||||
* otherwise it is restricted to introspecting signatures and related metadata.
|
||||
* <p>If no {@link FactoryBean#OBJECT_TYPE_ATTRIBUTE} if set on the bean definition
|
||||
* and {@code allowInit} is {@code true}, the default implementation will create
|
||||
* the FactoryBean via {@code getBean} to call its {@code getObjectType} method.
|
||||
* Subclasses are encouraged to optimize this, typically by inspecting the generic
|
||||
* signature of the factory bean class or the factory method that creates it. If
|
||||
* subclasses do instantiate the FactoryBean, they should consider trying the
|
||||
* {@code getObjectType} method without fully populating the bean. If this fails, a
|
||||
* full FactoryBean creation as performed by this implementation should be used as
|
||||
* fallback.
|
||||
* signature of the factory bean class or the factory method that creates it.
|
||||
* If subclasses do instantiate the FactoryBean, they should consider trying the
|
||||
* {@code getObjectType} method without fully populating the bean. If this fails,
|
||||
* a full FactoryBean creation as performed by this implementation should be used
|
||||
* as fallback.
|
||||
* @param beanName the name of the bean
|
||||
* @param mbd the merged bean definition for the bean
|
||||
* @param allowInit if initialization of the FactoryBean is permitted
|
||||
* @param allowInit if initialization of the FactoryBean is permitted if the type
|
||||
* cannot be determined another way
|
||||
* @return the type for the bean if determinable, otherwise {@code ResolvableType.NONE}
|
||||
* @since 5.2
|
||||
* @see org.springframework.beans.factory.FactoryBean#getObjectType()
|
||||
|
@ -1700,7 +1701,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
|||
try {
|
||||
FactoryBean<?> factoryBean = doGetBean(FACTORY_BEAN_PREFIX + beanName, FactoryBean.class, null, true);
|
||||
Class<?> objectType = getTypeForFactoryBean(factoryBean);
|
||||
return (objectType != null) ? ResolvableType.forClass(objectType) : ResolvableType.NONE;
|
||||
return (objectType != null ? ResolvableType.forClass(objectType) : ResolvableType.NONE);
|
||||
}
|
||||
catch (BeanCreationException ex) {
|
||||
if (ex.contains(BeanCurrentlyInCreationException.class)) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
|
@ -67,8 +67,6 @@ import org.springframework.core.annotation.AliasFor;
|
|||
* @see PutMapping
|
||||
* @see DeleteMapping
|
||||
* @see PatchMapping
|
||||
* @see org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
|
||||
* @see org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
@ -120,9 +118,8 @@ public @interface RequestMapping {
|
|||
* The HTTP request methods to map to, narrowing the primary mapping:
|
||||
* GET, POST, HEAD, OPTIONS, PUT, PATCH, DELETE, TRACE.
|
||||
* <p><b>Supported at the type level as well as at the method level!</b>
|
||||
* When used at the type level, all method-level mappings inherit
|
||||
* this HTTP method restriction (i.e. the type-level restriction
|
||||
* gets checked before the handler method is even resolved).
|
||||
* When used at the type level, all method-level mappings inherit this
|
||||
* HTTP method restriction.
|
||||
*/
|
||||
RequestMethod[] method() default {};
|
||||
|
||||
|
@ -136,13 +133,8 @@ public @interface RequestMapping {
|
|||
* any value). Finally, "!myParam" style expressions indicate that the
|
||||
* specified parameter is <i>not</i> supposed to be present in the request.
|
||||
* <p><b>Supported at the type level as well as at the method level!</b>
|
||||
* When used at the type level, all method-level mappings inherit
|
||||
* this parameter restriction (i.e. the type-level restriction
|
||||
* gets checked before the handler method is even resolved).
|
||||
* <p>Parameter mappings are considered as restrictions that are enforced at
|
||||
* the type level. The primary path mapping (i.e. the specified URI value)
|
||||
* still has to uniquely identify the target handler, with parameter mappings
|
||||
* simply expressing preconditions for invoking the handler.
|
||||
* When used at the type level, all method-level mappings inherit this
|
||||
* parameter restriction.
|
||||
*/
|
||||
String[] params() default {};
|
||||
|
||||
|
@ -162,9 +154,8 @@ public @interface RequestMapping {
|
|||
* </pre>
|
||||
* will match requests with a Content-Type of "text/html", "text/plain", etc.
|
||||
* <p><b>Supported at the type level as well as at the method level!</b>
|
||||
* When used at the type level, all method-level mappings inherit
|
||||
* this header restriction (i.e. the type-level restriction
|
||||
* gets checked before the handler method is even resolved).
|
||||
* When used at the type level, all method-level mappings inherit this
|
||||
* header restriction.
|
||||
* @see org.springframework.http.MediaType
|
||||
*/
|
||||
String[] headers() default {};
|
||||
|
|
Loading…
Reference in New Issue