Polishing (aligned with main)

This commit is contained in:
Juergen Hoeller
2025-08-06 19:01:18 +02:00
parent da13a24604
commit 5df9fd4eff
5 changed files with 31 additions and 14 deletions
@@ -121,12 +121,12 @@ public abstract class AopConfigUtils {
Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
if (registry.containsBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME)) {
BeanDefinition apcDefinition = registry.getBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME);
if (!cls.getName().equals(apcDefinition.getBeanClassName())) {
int currentPriority = findPriorityForClass(apcDefinition.getBeanClassName());
BeanDefinition beanDefinition = registry.getBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME);
if (!cls.getName().equals(beanDefinition.getBeanClassName())) {
int currentPriority = findPriorityForClass(beanDefinition.getBeanClassName());
int requiredPriority = findPriorityForClass(cls);
if (currentPriority < requiredPriority) {
apcDefinition.setBeanClassName(cls.getName());
beanDefinition.setBeanClassName(cls.getName());
}
}
return null;
@@ -134,8 +134,8 @@ public abstract class AopConfigUtils {
RootBeanDefinition beanDefinition = new RootBeanDefinition(cls);
beanDefinition.setSource(source);
beanDefinition.getPropertyValues().add("order", Ordered.HIGHEST_PRECEDENCE);
beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
beanDefinition.getPropertyValues().add("order", Ordered.HIGHEST_PRECEDENCE);
registry.registerBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME, beanDefinition);
return beanDefinition;
}
@@ -117,6 +117,7 @@ public abstract class AbstractAdvisingBeanPostProcessor extends ProxyProcessorSu
}
proxyFactory.addAdvisor(this.advisor);
customizeProxyFactory(proxyFactory);
proxyFactory.setPreFiltered(true);
// Use original ClassLoader if bean class not locally loaded in overriding class loader
ClassLoader classLoader = getProxyClassLoader();
@@ -24,9 +24,9 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.lang.Nullable;
/**
* Extension of {@link AbstractAutoProxyCreator} which implements {@link BeanFactoryAware},
* adds exposure of the original target class for each proxied bean
* ({@link AutoProxyUtils#ORIGINAL_TARGET_CLASS_ATTRIBUTE}),
* Extension of {@link AbstractAdvisingBeanPostProcessor} which implements
* {@link BeanFactoryAware}, adds exposure of the original target class for each
* proxied bean ({@link AutoProxyUtils#ORIGINAL_TARGET_CLASS_ATTRIBUTE}),
* and participates in an externally enforced target-class mode for any given bean
* ({@link AutoProxyUtils#PRESERVE_TARGET_CLASS_ATTRIBUTE}).
* This post-processor is therefore aligned with {@link AbstractAutoProxyCreator}.
@@ -51,9 +51,9 @@ import org.springframework.core.annotation.AliasFor;
* ignored.
*
* @author Stephane Nicoll
* @since 6.2
* @see Reflective @Reflective
* @see RegisterReflection @RegisterReflection
* @since 6.2
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@@ -30,7 +30,6 @@ import org.springframework.util.Assert;
*
* @author Rossen Stoyanchev
* @since 6.2
*
* @see <a href="https://www.rfc-editor.org/info/rfc3986">RFC 3986</a>
*/
abstract class RfcUriParser {
@@ -78,10 +77,10 @@ abstract class RfcUriParser {
* @param query the query, if present
* @param fragment the fragment, if present
*/
record UriRecord(@Nullable String scheme, boolean isOpaque,
@Nullable String user, @Nullable String host, @Nullable String port,
@Nullable String path, @Nullable String query, @Nullable String fragment) {
record UriRecord(
@Nullable String scheme, boolean isOpaque,
@Nullable String user, @Nullable String host, @Nullable String port,
@Nullable String path, @Nullable String query, @Nullable String fragment) {
}
@@ -130,6 +129,7 @@ abstract class RfcUriParser {
}
},
HOST_OR_PATH {
@Override
@@ -158,6 +158,7 @@ abstract class RfcUriParser {
}
},
SCHEME_OR_PATH {
@Override
@@ -188,6 +189,7 @@ abstract class RfcUriParser {
}
},
HOST {
@Override
@@ -229,6 +231,7 @@ abstract class RfcUriParser {
}
},
IPV6 {
@Override
@@ -259,6 +262,7 @@ abstract class RfcUriParser {
}
},
PORT {
@Override
@@ -291,6 +295,7 @@ abstract class RfcUriParser {
}
},
PATH {
@Override
@@ -319,6 +324,7 @@ abstract class RfcUriParser {
}
},
QUERY {
@Override
@@ -334,7 +340,9 @@ abstract class RfcUriParser {
}
},
FRAGMENT {
@Override
public void handleNext(InternalParser parser, char c, int i) {
}
@@ -345,6 +353,7 @@ abstract class RfcUriParser {
}
},
WILDCARD {
@Override
@@ -358,6 +367,7 @@ abstract class RfcUriParser {
}
};
/**
* Method to handle each character from the input string.
* @param parser provides access to parsing state, and helper methods
@@ -429,6 +439,7 @@ abstract class RfcUriParser {
this.uri = uri;
}
// Check internal state
public boolean hasScheme() {
@@ -451,6 +462,7 @@ abstract class RfcUriParser {
return (this.index == this.componentIndex);
}
// Top-level parse loop, iterate over chars and delegate to states
public UriRecord parse() {
@@ -475,6 +487,7 @@ abstract class RfcUriParser {
return this.uri.charAt(this.index);
}
// Transitions and index updates
public void advanceTo(State state) {
@@ -500,6 +513,7 @@ abstract class RfcUriParser {
this.index = index;
}
// Component capture
public InternalParser resolveIfOpaque() {
@@ -593,6 +607,7 @@ abstract class RfcUriParser {
return this;
}
// Encoding and curly bracket handling
/**
@@ -643,6 +658,7 @@ abstract class RfcUriParser {
return (this.openCurlyBracketCount > 0);
}
@Override
public String toString() {
return "[State=" + this.state + ", index=" + this.index + ", componentIndex=" + this.componentIndex +