Browse Source

Merge branch '6.0.x'

# Conflicts:
#	spring-context/src/test/java/org/springframework/context/annotation/PropertySourceAnnotationTests.java
pull/31063/head
Juergen Hoeller 1 year ago
parent
commit
45c20e34e4
  1. 26
      spring-beans/src/test/resources/org/springframework/beans/factory/FactoryBeanTests-withAutowiring.xml
  2. 4
      spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/BeanFactoryJCacheOperationSourceAdvisor.java
  3. 4
      spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperationSourcePointcut.java
  4. 16
      spring-context/src/main/java/org/springframework/context/annotation/PropertySourceRegistry.java
  5. 2
      spring-jdbc/src/main/java/org/springframework/jdbc/core/BeanPropertyRowMapper.java
  6. 3
      spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/PayloadMethodArgumentResolver.java
  7. 4
      spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourcePointcut.java

26
spring-beans/src/test/resources/org/springframework/beans/factory/FactoryBeanTests-withAutowiring.xml

@ -4,25 +4,27 @@ @@ -4,25 +4,27 @@
<beans default-lazy-init="true">
<bean name="beta" class="org.springframework.beans.factory.FactoryBeanTests$Beta" autowire="byType">
<property name="name" value="${myName}"/>
<property name="name" value="${myName}"/>
</bean>
<bean id="alpha" class="org.springframework.beans.factory.FactoryBeanTests$Alpha" autowire="byType"/>
<bean id="gamma" class="org.springframework.beans.factory.FactoryBeanTests$Gamma"/>
<bean id="betaFactory" class="org.springframework.beans.factory.FactoryBeanTests$BetaFactoryBean" autowire="constructor">
<property name="beta" ref="beta"/>
</bean>
<bean id="betaFactory" class="org.springframework.beans.factory.FactoryBeanTests$BetaFactoryBean" autowire="constructor">
<property name="beta" ref="beta"/>
</bean>
<bean id="gammaFactory" factory-bean="betaFactory" factory-method="getGamma"/>
<bean id="gammaFactory" factory-bean="${gammaFactory}" factory-method="${gamma}"/>
<bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties">
<props>
<prop key="myName">yourName</prop>
</props>
</property>
</bean>
<bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties">
<props>
<prop key="myName">yourName</prop>
<prop key="gammaFactory">betaFactory</prop>
<prop key="gamma">getGamma</prop>
</props>
</property>
</bean>
</beans>

4
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/BeanFactoryJCacheOperationSourceAdvisor.java vendored

@ -82,8 +82,8 @@ public class BeanFactoryJCacheOperationSourceAdvisor extends AbstractBeanFactory @@ -82,8 +82,8 @@ public class BeanFactoryJCacheOperationSourceAdvisor extends AbstractBeanFactory
@Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof JCacheOperationSourcePointcut otherPc &&
ObjectUtils.nullSafeEquals(this.cacheOperationSource, otherPc.cacheOperationSource)));
return (this == other || (other instanceof JCacheOperationSourcePointcut that &&
ObjectUtils.nullSafeEquals(this.cacheOperationSource, that.cacheOperationSource)));
}
@Override

4
spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperationSourcePointcut.java vendored

@ -58,8 +58,8 @@ class CacheOperationSourcePointcut extends StaticMethodMatcherPointcut implement @@ -58,8 +58,8 @@ class CacheOperationSourcePointcut extends StaticMethodMatcherPointcut implement
@Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof CacheOperationSourcePointcut otherPc &&
ObjectUtils.nullSafeEquals(this.cacheOperationSource, otherPc.cacheOperationSource)));
return (this == other || (other instanceof CacheOperationSourcePointcut that &&
ObjectUtils.nullSafeEquals(this.cacheOperationSource, that.cacheOperationSource)));
}
@Override

16
spring-context/src/main/java/org/springframework/context/annotation/PropertySourceRegistry.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 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.
@ -42,14 +42,12 @@ class PropertySourceRegistry { @@ -42,14 +42,12 @@ class PropertySourceRegistry {
private final List<PropertySourceDescriptor> descriptors;
public PropertySourceRegistry(PropertySourceProcessor propertySourceProcessor) {
this.propertySourceProcessor = propertySourceProcessor;
this.descriptors = new ArrayList<>();
}
public List<PropertySourceDescriptor> getDescriptors() {
return Collections.unmodifiableList(this.descriptors);
}
/**
* Process the given <code>@PropertySource</code> annotation metadata.
@ -70,12 +68,16 @@ class PropertySourceRegistry { @@ -70,12 +68,16 @@ class PropertySourceRegistry {
boolean ignoreResourceNotFound = propertySource.getBoolean("ignoreResourceNotFound");
Class<? extends PropertySourceFactory> factoryClass = propertySource.getClass("factory");
Class<? extends PropertySourceFactory> factorClassToUse =
Class<? extends PropertySourceFactory> factoryClassToUse =
(factoryClass != PropertySourceFactory.class ? factoryClass : null);
PropertySourceDescriptor descriptor = new PropertySourceDescriptor(Arrays.asList(locations), ignoreResourceNotFound, name,
factorClassToUse, encoding);
PropertySourceDescriptor descriptor = new PropertySourceDescriptor(Arrays.asList(locations),
ignoreResourceNotFound, name, factoryClassToUse, encoding);
this.propertySourceProcessor.processPropertySource(descriptor);
this.descriptors.add(descriptor);
}
public List<PropertySourceDescriptor> getDescriptors() {
return Collections.unmodifiableList(this.descriptors);
}
}

2
spring-jdbc/src/main/java/org/springframework/jdbc/core/BeanPropertyRowMapper.java

@ -343,7 +343,7 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T> { @@ -343,7 +343,7 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T> {
bw.setPropertyValue(pd.getName(), value);
}
catch (TypeMismatchException ex) {
if (value == null && this.primitivesDefaultedForNullValue) {
if (value == null && isPrimitivesDefaultedForNullValue()) {
if (logger.isDebugEnabled()) {
String propertyType = ClassUtils.getQualifiedName(pd.getPropertyType());
logger.debug("""

3
spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/PayloadMethodArgumentResolver.java

@ -197,8 +197,7 @@ public class PayloadMethodArgumentResolver implements HandlerMethodArgumentResol @@ -197,8 +197,7 @@ public class PayloadMethodArgumentResolver implements HandlerMethodArgumentResol
/**
* Validate the payload if applicable.
* <p>The default implementation checks for {@code @jakarta.validation.Valid},
* Spring's {@link Validated},
* and custom annotations whose name starts with "Valid".
* Spring's {@link Validated}, and custom annotations whose name starts with "Valid".
* @param message the currently processed message
* @param parameter the method parameter
* @param target the target payload object

4
spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourcePointcut.java

@ -57,8 +57,8 @@ class TransactionAttributeSourcePointcut extends StaticMethodMatcherPointcut imp @@ -57,8 +57,8 @@ class TransactionAttributeSourcePointcut extends StaticMethodMatcherPointcut imp
@Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof TransactionAttributeSourcePointcut otherPc &&
ObjectUtils.nullSafeEquals(this.transactionAttributeSource, otherPc.transactionAttributeSource)));
return (this == other || (other instanceof TransactionAttributeSourcePointcut that &&
ObjectUtils.nullSafeEquals(this.transactionAttributeSource, that.transactionAttributeSource)));
}
@Override

Loading…
Cancel
Save