diff --git a/build.gradle b/build.gradle index d0b6899b643..0234980654b 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,7 @@ configure(allprojects) { project -> dependencyManagement { imports { mavenBom "com.fasterxml.jackson:jackson-bom:2.11.0" - mavenBom "io.netty:netty-bom:4.1.50.Final" + mavenBom "io.netty:netty-bom:4.1.51.Final" mavenBom "io.projectreactor:reactor-bom:2020.0.0-SNAPSHOT" mavenBom "io.r2dbc:r2dbc-bom:Arabba-SR5" mavenBom "io.rsocket:rsocket-bom:1.1.0-SNAPSHOT" @@ -65,7 +65,7 @@ configure(allprojects) { project -> dependency "io.reactivex.rxjava3:rxjava:3.0.4" dependency "io.projectreactor.tools:blockhound:1.0.2.RELEASE" - dependency "com.caucho:hessian:4.0.62" + dependency "com.caucho:hessian:4.0.63" dependency "com.fasterxml:aalto-xml:1.2.2" dependency("com.fasterxml.woodstox:woodstox-core:6.1.1") { exclude group: "stax", name: "stax-api" @@ -77,7 +77,7 @@ configure(allprojects) { project -> exclude group: "xpp3", name: "xpp3_min" exclude group: "xmlpull", name: "xmlpull" } - dependency "org.apache.johnzon:johnzon-jsonb:1.2.7" + dependency "org.apache.johnzon:johnzon-jsonb:1.2.8" dependency("org.codehaus.jettison:jettison:1.3.8") { exclude group: "stax", name: "stax-api" } @@ -89,8 +89,8 @@ configure(allprojects) { project -> dependency "org.yaml:snakeyaml:1.26" dependency "com.h2database:h2:1.4.200" - dependency "com.github.ben-manes.caffeine:caffeine:2.8.4" - dependency "com.github.librepdf:openpdf:1.3.19" + dependency "com.github.ben-manes.caffeine:caffeine:2.8.5" + dependency "com.github.librepdf:openpdf:1.3.20" dependency "com.rometools:rome:1.13.1" dependency "commons-io:commons-io:2.5" dependency "io.vavr:vavr:0.10.3" @@ -122,14 +122,14 @@ configure(allprojects) { project -> dependency "org.webjars:webjars-locator-core:0.45" dependency "org.webjars:underscorejs:1.8.3" - dependencySet(group: 'org.apache.tomcat', version: '9.0.36') { + dependencySet(group: 'org.apache.tomcat', version: '9.0.37') { entry 'tomcat-util' entry('tomcat-websocket') { exclude group: "org.apache.tomcat", name: "tomcat-websocket-api" exclude group: "org.apache.tomcat", name: "tomcat-servlet-api" } } - dependencySet(group: 'org.apache.tomcat.embed', version: '9.0.36') { + dependencySet(group: 'org.apache.tomcat.embed', version: '9.0.37') { entry 'tomcat-embed-core' entry 'tomcat-embed-websocket' } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java index 0fa9a6a5514..c30bc3271a1 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java @@ -945,16 +945,20 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess } /** - * Specify whether or not the configured init method is the default. - *
The default value is {@code false}. + * Specify whether or not the configured initializer method is the default. + *
The default value is {@code true} for a locally specified init method + * but switched to {@code false} for a shared setting in a defaults section + * (e.g. {@code bean init-method} versus {@code beans default-init-method} + * level in XML) which might not apply to all contained bean definitions. * @see #setInitMethodName + * @see #applyDefaults */ public void setEnforceInitMethod(boolean enforceInitMethod) { this.enforceInitMethod = enforceInitMethod; } /** - * Indicate whether the configured init method is the default. + * Indicate whether the configured initializer method is the default. * @see #getInitMethodName() */ public boolean isEnforceInitMethod() { @@ -981,8 +985,12 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess /** * Specify whether or not the configured destroy method is the default. - *
The default value is {@code false}. + *
The default value is {@code true} for a locally specified destroy method + * but switched to {@code false} for a shared setting in a defaults section + * (e.g. {@code bean destroy-method} versus {@code beans default-destroy-method} + * level in XML) which might not apply to all contained bean definitions. * @see #setDestroyMethodName + * @see #applyDefaults */ public void setEnforceDestroyMethod(boolean enforceDestroyMethod) { this.enforceDestroyMethod = enforceDestroyMethod; @@ -990,7 +998,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess /** * Indicate whether the configured destroy method is the default. - * @see #getDestroyMethodName + * @see #getDestroyMethodName() */ public boolean isEnforceDestroyMethod() { return this.enforceDestroyMethod; diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java index f98567a0707..5da53bfe3b6 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java @@ -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. @@ -25,6 +25,7 @@ import org.springframework.util.StringUtils; * @author Mark Fisher * @author Juergen Hoeller * @since 2.5 + * @see AbstractBeanDefinition#applyDefaults */ public class BeanDefinitionDefaults { @@ -46,6 +47,7 @@ public class BeanDefinitionDefaults { * Set whether beans should be lazily initialized by default. *
If {@code false}, the bean will get instantiated on startup by bean * factories that perform eager initialization of singletons. + * @see AbstractBeanDefinition#setLazyInit */ public void setLazyInit(boolean lazyInit) { this.lazyInit = lazyInit; @@ -78,6 +80,7 @@ public class BeanDefinitionDefaults { * (however, there may still be explicit annotation-driven autowiring). * @param autowireMode the autowire mode to set. * Must be one of the constants defined in {@link AbstractBeanDefinition}. + * @see AbstractBeanDefinition#setAutowireMode */ public void setAutowireMode(int autowireMode) { this.autowireMode = autowireMode; @@ -94,6 +97,7 @@ public class BeanDefinitionDefaults { * Set the dependency check code. * @param dependencyCheck the code to set. * Must be one of the constants defined in {@link AbstractBeanDefinition}. + * @see AbstractBeanDefinition#setDependencyCheck */ public void setDependencyCheck(int dependencyCheck) { this.dependencyCheck = dependencyCheck; @@ -108,6 +112,10 @@ public class BeanDefinitionDefaults { /** * Set the name of the default initializer method. + *
Note that this method is not enforced on all affected bean definitions + * but rather taken as an optional callback, to be invoked if actually present. + * @see AbstractBeanDefinition#setInitMethodName + * @see AbstractBeanDefinition#setEnforceInitMethod */ public void setInitMethodName(@Nullable String initMethodName) { this.initMethodName = (StringUtils.hasText(initMethodName) ? initMethodName : null); @@ -123,6 +131,10 @@ public class BeanDefinitionDefaults { /** * Set the name of the default destroy method. + *
Note that this method is not enforced on all affected bean definitions
+ * but rather taken as an optional callback, to be invoked if actually present.
+ * @see AbstractBeanDefinition#setDestroyMethodName
+ * @see AbstractBeanDefinition#setEnforceDestroyMethod
*/
public void setDestroyMethodName(@Nullable String destroyMethodName) {
this.destroyMethodName = (StringUtils.hasText(destroyMethodName) ? destroyMethodName : null);
diff --git a/spring-context/src/main/java/org/springframework/ejb/config/AbstractJndiLocatingBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/ejb/config/AbstractJndiLocatingBeanDefinitionParser.java
index 51e9a3fff95..34c4ac5c9ad 100644
--- a/spring-context/src/main/java/org/springframework/ejb/config/AbstractJndiLocatingBeanDefinitionParser.java
+++ b/spring-context/src/main/java/org/springframework/ejb/config/AbstractJndiLocatingBeanDefinitionParser.java
@@ -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.
@@ -49,8 +49,9 @@ abstract class AbstractJndiLocatingBeanDefinitionParser extends AbstractSimpleBe
@Override
protected boolean isEligibleAttribute(String attributeName) {
- return (super.isEligibleAttribute(attributeName) && !ENVIRONMENT_REF.equals(attributeName) && !LAZY_INIT_ATTRIBUTE
- .equals(attributeName));
+ return (super.isEligibleAttribute(attributeName) &&
+ !ENVIRONMENT_REF.equals(attributeName) &&
+ !LAZY_INIT_ATTRIBUTE.equals(attributeName));
}
@Override
diff --git a/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerTests.java b/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerTests.java
index 2b4ac0d08c0..ec9662810e6 100644
--- a/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerTests.java
+++ b/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerTests.java
@@ -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.
@@ -42,8 +42,9 @@ public class JeeNamespaceHandlerTests {
private ConfigurableListableBeanFactory beanFactory;
+
@BeforeEach
- public void setUp() throws Exception {
+ public void setup() {
GenericApplicationContext ctx = new GenericApplicationContext();
new XmlBeanDefinitionReader(ctx).loadBeanDefinitions(
new ClassPathResource("jeeNamespaceHandlerTests.xml", getClass()));
@@ -52,8 +53,9 @@ public class JeeNamespaceHandlerTests {
this.beanFactory.getBeanNamesForType(ITestBean.class);
}
+
@Test
- public void testSimpleDefinition() throws Exception {
+ public void testSimpleDefinition() {
BeanDefinition beanDefinition = this.beanFactory.getMergedBeanDefinition("simple");
assertThat(beanDefinition.getBeanClassName()).isEqualTo(JndiObjectFactoryBean.class.getName());
assertPropertyValue(beanDefinition, "jndiName", "jdbc/MyDataSource");
@@ -61,7 +63,7 @@ public class JeeNamespaceHandlerTests {
}
@Test
- public void testComplexDefinition() throws Exception {
+ public void testComplexDefinition() {
BeanDefinition beanDefinition = this.beanFactory.getMergedBeanDefinition("complex");
assertThat(beanDefinition.getBeanClassName()).isEqualTo(JndiObjectFactoryBean.class.getName());
assertPropertyValue(beanDefinition, "jndiName", "jdbc/MyDataSource");
@@ -75,21 +77,21 @@ public class JeeNamespaceHandlerTests {
}
@Test
- public void testWithEnvironment() throws Exception {
+ public void testWithEnvironment() {
BeanDefinition beanDefinition = this.beanFactory.getMergedBeanDefinition("withEnvironment");
assertPropertyValue(beanDefinition, "jndiEnvironment", "foo=bar");
assertPropertyValue(beanDefinition, "defaultObject", new RuntimeBeanReference("myBean"));
}
@Test
- public void testWithReferencedEnvironment() throws Exception {
+ public void testWithReferencedEnvironment() {
BeanDefinition beanDefinition = this.beanFactory.getMergedBeanDefinition("withReferencedEnvironment");
assertPropertyValue(beanDefinition, "jndiEnvironment", new RuntimeBeanReference("myEnvironment"));
assertThat(beanDefinition.getPropertyValues().contains("environmentRef")).isFalse();
}
@Test
- public void testSimpleLocalSlsb() throws Exception {
+ public void testSimpleLocalSlsb() {
BeanDefinition beanDefinition = this.beanFactory.getMergedBeanDefinition("simpleLocalEjb");
assertThat(beanDefinition.getBeanClassName()).isEqualTo(LocalStatelessSessionProxyFactoryBean.class.getName());
assertPropertyValue(beanDefinition, "businessInterface", ITestBean.class.getName());
@@ -97,7 +99,7 @@ public class JeeNamespaceHandlerTests {
}
@Test
- public void testSimpleRemoteSlsb() throws Exception {
+ public void testSimpleRemoteSlsb() {
BeanDefinition beanDefinition = this.beanFactory.getMergedBeanDefinition("simpleRemoteEjb");
assertThat(beanDefinition.getBeanClassName()).isEqualTo(SimpleRemoteStatelessSessionProxyFactoryBean.class.getName());
assertPropertyValue(beanDefinition, "businessInterface", ITestBean.class.getName());
@@ -105,7 +107,7 @@ public class JeeNamespaceHandlerTests {
}
@Test
- public void testComplexLocalSlsb() throws Exception {
+ public void testComplexLocalSlsb() {
BeanDefinition beanDefinition = this.beanFactory.getMergedBeanDefinition("complexLocalEjb");
assertThat(beanDefinition.getBeanClassName()).isEqualTo(LocalStatelessSessionProxyFactoryBean.class.getName());
assertPropertyValue(beanDefinition, "businessInterface", ITestBean.class.getName());
@@ -117,7 +119,7 @@ public class JeeNamespaceHandlerTests {
}
@Test
- public void testComplexRemoteSlsb() throws Exception {
+ public void testComplexRemoteSlsb() {
BeanDefinition beanDefinition = this.beanFactory.getMergedBeanDefinition("complexRemoteEjb");
assertThat(beanDefinition.getBeanClassName()).isEqualTo(SimpleRemoteStatelessSessionProxyFactoryBean.class.getName());
assertPropertyValue(beanDefinition, "businessInterface", ITestBean.class.getName());
@@ -132,7 +134,7 @@ public class JeeNamespaceHandlerTests {
}
@Test
- public void testLazyInitJndiLookup() throws Exception {
+ public void testLazyInitJndiLookup() {
BeanDefinition definition = this.beanFactory.getMergedBeanDefinition("lazyDataSource");
assertThat(definition.isLazyInit()).isTrue();
definition = this.beanFactory.getMergedBeanDefinition("lazyLocalBean");
diff --git a/spring-core/src/main/java/org/springframework/core/env/MutablePropertySources.java b/spring-core/src/main/java/org/springframework/core/env/MutablePropertySources.java
index 1fa383b38d9..1bc07bc7b54 100644
--- a/spring-core/src/main/java/org/springframework/core/env/MutablePropertySources.java
+++ b/spring-core/src/main/java/org/springframework/core/env/MutablePropertySources.java
@@ -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.
@@ -79,14 +79,23 @@ public class MutablePropertySources implements PropertySources {
@Override
public boolean contains(String name) {
- return this.propertySourceList.contains(PropertySource.named(name));
+ for (PropertySource> propertySource : this.propertySourceList) {
+ if (propertySource.getName().equals(name)) {
+ return true;
+ }
+ }
+ return false;
}
@Override
@Nullable
public PropertySource> get(String name) {
- int index = this.propertySourceList.indexOf(PropertySource.named(name));
- return (index != -1 ? this.propertySourceList.get(index) : null);
+ for (PropertySource> propertySource : this.propertySourceList) {
+ if (propertySource.getName().equals(name)) {
+ return propertySource;
+ }
+ }
+ return null;
}
@@ -94,16 +103,20 @@ public class MutablePropertySources implements PropertySources {
* Add the given property source object with highest precedence.
*/
public void addFirst(PropertySource> propertySource) {
- removeIfPresent(propertySource);
- this.propertySourceList.add(0, propertySource);
+ synchronized (this.propertySourceList) {
+ removeIfPresent(propertySource);
+ this.propertySourceList.add(0, propertySource);
+ }
}
/**
* Add the given property source object with lowest precedence.
*/
public void addLast(PropertySource> propertySource) {
- removeIfPresent(propertySource);
- this.propertySourceList.add(propertySource);
+ synchronized (this.propertySourceList) {
+ removeIfPresent(propertySource);
+ this.propertySourceList.add(propertySource);
+ }
}
/**
@@ -112,9 +125,11 @@ public class MutablePropertySources implements PropertySources {
*/
public void addBefore(String relativePropertySourceName, PropertySource> propertySource) {
assertLegalRelativeAddition(relativePropertySourceName, propertySource);
- removeIfPresent(propertySource);
- int index = assertPresentAndGetIndex(relativePropertySourceName);
- addAtIndex(index, propertySource);
+ synchronized (this.propertySourceList) {
+ removeIfPresent(propertySource);
+ int index = assertPresentAndGetIndex(relativePropertySourceName);
+ addAtIndex(index, propertySource);
+ }
}
/**
@@ -123,9 +138,11 @@ public class MutablePropertySources implements PropertySources {
*/
public void addAfter(String relativePropertySourceName, PropertySource> propertySource) {
assertLegalRelativeAddition(relativePropertySourceName, propertySource);
- removeIfPresent(propertySource);
- int index = assertPresentAndGetIndex(relativePropertySourceName);
- addAtIndex(index + 1, propertySource);
+ synchronized (this.propertySourceList) {
+ removeIfPresent(propertySource);
+ int index = assertPresentAndGetIndex(relativePropertySourceName);
+ addAtIndex(index + 1, propertySource);
+ }
}
/**
@@ -141,8 +158,10 @@ public class MutablePropertySources implements PropertySources {
*/
@Nullable
public PropertySource> remove(String name) {
- int index = this.propertySourceList.indexOf(PropertySource.named(name));
- return (index != -1 ? this.propertySourceList.remove(index) : null);
+ synchronized (this.propertySourceList) {
+ int index = this.propertySourceList.indexOf(PropertySource.named(name));
+ return (index != -1 ? this.propertySourceList.remove(index) : null);
+ }
}
/**
@@ -153,8 +172,10 @@ public class MutablePropertySources implements PropertySources {
* @see #contains
*/
public void replace(String name, PropertySource> propertySource) {
- int index = assertPresentAndGetIndex(name);
- this.propertySourceList.set(index, propertySource);
+ synchronized (this.propertySourceList) {
+ int index = assertPresentAndGetIndex(name);
+ this.propertySourceList.set(index, propertySource);
+ }
}
/**
@@ -169,6 +190,7 @@ public class MutablePropertySources implements PropertySources {
return this.propertySourceList.toString();
}
+
/**
* Ensure that the given property source is not being added relative to itself.
*/
diff --git a/spring-core/src/main/java/org/springframework/core/env/PropertySource.java b/spring-core/src/main/java/org/springframework/core/env/PropertySource.java
index c8a1da6bb82..24a71ddfadf 100644
--- a/spring-core/src/main/java/org/springframework/core/env/PropertySource.java
+++ b/spring-core/src/main/java/org/springframework/core/env/PropertySource.java
@@ -136,7 +136,7 @@ public abstract class PropertySource By default all headers are allowed.
*/
public CorsRegistration allowedHeaders(String... headers) {
- this.config.setAllowedHeaders(new ArrayList<>(Arrays.asList(headers)));
+ this.config.setAllowedHeaders(Arrays.asList(headers));
return this;
}
@@ -101,7 +102,7 @@ public class CorsRegistration {
* By default this is not set.
*/
public CorsRegistration exposedHeaders(String... headers) {
- this.config.setExposedHeaders(new ArrayList<>(Arrays.asList(headers)));
+ this.config.setExposedHeaders(Arrays.asList(headers));
return this;
}
diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistry.java b/spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistry.java
index b0b817d2693..263e66c15ee 100644
--- a/spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistry.java
+++ b/spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistry.java
@@ -37,11 +37,9 @@ public class CorsRegistry {
/**
- * Enable cross origin request handling for the specified path pattern.
- *
+ * Enable cross-origin request handling for the specified path pattern.
* Exact path mapping URIs (such as {@code "/admin"}) are supported as
* well as Ant-style path patterns (such as {@code "/admin/**"}).
- *
* By default, the {@code CorsConfiguration} for this mapping is
* initialized with default values as described in
* {@link CorsConfiguration#applyPermitDefaultValues()}.
@@ -52,6 +50,10 @@ public class CorsRegistry {
return registration;
}
+ /**
+ * Return the registered {@link CorsConfiguration} objects,
+ * keyed by path pattern.
+ */
protected Map By default "simple" methods, i.e. {@code GET}, {@code HEAD}, and
- * {@code POST} are allowed.
+ * The special value {@code "*"} allows all methods.
+ * By default "simple" methods {@code GET}, {@code HEAD}, and {@code POST}
+ * are allowed.
*/
public CorsRegistration allowedMethods(String... methods) {
this.config.setAllowedMethods(Arrays.asList(methods));
@@ -81,9 +81,9 @@ public class CorsRegistration {
}
/**
- * Set the list of headers that a preflight request can list as allowed
- * for use during an actual request. The special value {@code "*"} may be
- * used to allow all headers.
+ * Set the list of headers that a pre-flight request can list as allowed
+ * for use during an actual request.
+ * The special value {@code "*"} may be used to allow all headers.
* A header name is not required to be listed if it is one of:
* {@code Cache-Control}, {@code Content-Language}, {@code Expires},
* {@code Last-Modified}, or {@code Pragma} as per the CORS spec.
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistry.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistry.java
index da4c1493ad8..ad93c973ac9 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistry.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistry.java
@@ -39,10 +39,8 @@ public class CorsRegistry {
/**
* Enable cross-origin request handling for the specified path pattern.
- *
* Exact path mapping URIs (such as {@code "/admin"}) are supported as
* well as Ant-style path patterns (such as {@code "/admin/**"}).
- *
* By default, the {@code CorsConfiguration} for this mapping is
* initialized with default values as described in
* {@link CorsConfiguration#applyPermitDefaultValues()}.
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java
index 43fd25fa227..7173a4cbb74 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java
@@ -160,7 +160,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
private List