commit
198d64d539
14
build.gradle
14
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'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -945,16 +945,20 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
|||
}
|
||||
|
||||
/**
|
||||
* Specify whether or not the configured init method is the default.
|
||||
* <p>The default value is {@code false}.
|
||||
* Specify whether or not the configured initializer method is the default.
|
||||
* <p>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.
|
||||
* <p>The default value is {@code false}.
|
||||
* <p>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;
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
* <p>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.
|
||||
* <p>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.
|
||||
* <p>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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ public abstract class PropertySource<T> {
|
|||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof PropertySource &&
|
||||
ObjectUtils.nullSafeEquals(this.name, ((PropertySource<?>) other).name)));
|
||||
ObjectUtils.nullSafeEquals(getName(), ((PropertySource<?>) other).getName())));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -145,7 +145,7 @@ public abstract class PropertySource<T> {
|
|||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(this.name);
|
||||
return ObjectUtils.nullSafeHashCode(getName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -161,10 +161,10 @@ public abstract class PropertySource<T> {
|
|||
public String toString() {
|
||||
if (logger.isDebugEnabled()) {
|
||||
return getClass().getSimpleName() + "@" + System.identityHashCode(this) +
|
||||
" {name='" + this.name + "', properties=" + this.source + "}";
|
||||
" {name='" + getName() + "', properties=" + getSource() + "}";
|
||||
}
|
||||
else {
|
||||
return getClass().getSimpleName() + " {name='" + this.name + "'}";
|
||||
return getClass().getSimpleName() + " {name='" + getName() + "'}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -46,9 +46,8 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
|
|||
/** Logger available to subclasses. */
|
||||
protected static final Log logger = LogFactory.getLog(CallMetaDataProvider.class);
|
||||
|
||||
private boolean procedureColumnMetaDataUsed = false;
|
||||
|
||||
private String userName;
|
||||
private final String userName;
|
||||
|
||||
private boolean supportsCatalogsInProcedureCalls = true;
|
||||
|
||||
|
|
@ -58,7 +57,9 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
|
|||
|
||||
private boolean storesLowerCaseIdentifiers = false;
|
||||
|
||||
private List<CallParameterMetaData> callParameterMetaData = new ArrayList<>();
|
||||
private boolean procedureColumnMetaDataUsed = false;
|
||||
|
||||
private final List<CallParameterMetaData> callParameterMetaData = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -328,20 +329,34 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
|
|||
metaDataSchemaName + '/' + metaDataProcedureName);
|
||||
}
|
||||
|
||||
ResultSet procs = null;
|
||||
try {
|
||||
procs = databaseMetaData.getProcedures(metaDataCatalogName, metaDataSchemaName, metaDataProcedureName);
|
||||
List<String> found = new ArrayList<>();
|
||||
while (procs.next()) {
|
||||
found.add(procs.getString("PROCEDURE_CAT") + '.' + procs.getString("PROCEDURE_SCHEM") +
|
||||
'.' + procs.getString("PROCEDURE_NAME"));
|
||||
boolean function = false;
|
||||
|
||||
try (ResultSet procedures = databaseMetaData.getProcedures(
|
||||
metaDataCatalogName, metaDataSchemaName, metaDataProcedureName)) {
|
||||
while (procedures.next()) {
|
||||
found.add(procedures.getString("PROCEDURE_CAT") + '.' + procedures.getString("PROCEDURE_SCHEM") +
|
||||
'.' + procedures.getString("PROCEDURE_NAME"));
|
||||
}
|
||||
}
|
||||
|
||||
if (found.isEmpty()) {
|
||||
// Functions not exposed as procedures anymore on PostgreSQL driver 42.2.11
|
||||
try (ResultSet functions = databaseMetaData.getFunctions(
|
||||
metaDataCatalogName, metaDataSchemaName, metaDataProcedureName)) {
|
||||
while (functions.next()) {
|
||||
found.add(functions.getString("FUNCTION_CAT") + '.' + functions.getString("FUNCTION_SCHEM") +
|
||||
'.' + functions.getString("FUNCTION_NAME"));
|
||||
function = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
procs.close();
|
||||
|
||||
if (found.size() > 1) {
|
||||
throw new InvalidDataAccessApiUsageException(
|
||||
"Unable to determine the correct call signature - multiple " +
|
||||
"procedures/functions/signatures for '" + metaDataProcedureName + "': found " + found);
|
||||
"Unable to determine the correct call signature - multiple signatures for '" +
|
||||
metaDataProcedureName + "': found " + found + " " + (function ? "functions" : "procedures"));
|
||||
}
|
||||
else if (found.isEmpty()) {
|
||||
if (metaDataProcedureName != null && metaDataProcedureName.contains(".") &&
|
||||
|
|
@ -365,30 +380,34 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
|
|||
}
|
||||
}
|
||||
|
||||
procs = databaseMetaData.getProcedureColumns(
|
||||
metaDataCatalogName, metaDataSchemaName, metaDataProcedureName, null);
|
||||
while (procs.next()) {
|
||||
String columnName = procs.getString("COLUMN_NAME");
|
||||
int columnType = procs.getInt("COLUMN_TYPE");
|
||||
if (columnName == null && (
|
||||
columnType == DatabaseMetaData.procedureColumnIn ||
|
||||
columnType == DatabaseMetaData.procedureColumnInOut ||
|
||||
columnType == DatabaseMetaData.procedureColumnOut)) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Skipping meta-data for: " + columnType + " " + procs.getInt("DATA_TYPE") +
|
||||
" " + procs.getString("TYPE_NAME") + " " + procs.getInt("NULLABLE") +
|
||||
" (probably a member of a collection)");
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Retrieving column meta-data for " + (function ? "function" : "procedure") + ' ' +
|
||||
metaDataCatalogName + '/' + metaDataSchemaName + '/' + metaDataProcedureName);
|
||||
}
|
||||
try (ResultSet columns = function ?
|
||||
databaseMetaData.getFunctionColumns(metaDataCatalogName, metaDataSchemaName, metaDataProcedureName, null) :
|
||||
databaseMetaData.getProcedureColumns(metaDataCatalogName, metaDataSchemaName, metaDataProcedureName, null)) {
|
||||
while (columns.next()) {
|
||||
String columnName = columns.getString("COLUMN_NAME");
|
||||
int columnType = columns.getInt("COLUMN_TYPE");
|
||||
if (columnName == null && isInOrOutColumn(columnType, function)) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Skipping meta-data for: " + columnType + " " + columns.getInt("DATA_TYPE") +
|
||||
" " + columns.getString("TYPE_NAME") + " " + columns.getInt("NULLABLE") +
|
||||
" (probably a member of a collection)");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
CallParameterMetaData meta = new CallParameterMetaData(columnName, columnType,
|
||||
procs.getInt("DATA_TYPE"), procs.getString("TYPE_NAME"),
|
||||
procs.getInt("NULLABLE") == DatabaseMetaData.procedureNullable);
|
||||
this.callParameterMetaData.add(meta);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Retrieved meta-data: " + meta.getParameterName() + " " +
|
||||
meta.getParameterType() + " " + meta.getSqlType() + " " +
|
||||
meta.getTypeName() + " " + meta.isNullable());
|
||||
else {
|
||||
int nullable = (function ? DatabaseMetaData.functionNullable : DatabaseMetaData.procedureNullable);
|
||||
CallParameterMetaData meta = new CallParameterMetaData(columnName, columnType,
|
||||
columns.getInt("DATA_TYPE"), columns.getString("TYPE_NAME"),
|
||||
columns.getInt("NULLABLE") == nullable);
|
||||
this.callParameterMetaData.add(meta);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Retrieved meta-data: " + meta.getParameterName() + " " +
|
||||
meta.getParameterType() + " " + meta.getSqlType() + " " +
|
||||
meta.getTypeName() + " " + meta.isNullable());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -398,17 +417,18 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
|
|||
logger.warn("Error while retrieving meta-data for procedure columns: " + ex);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
if (procs != null) {
|
||||
procs.close();
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Problem closing ResultSet for procedure column meta-data: " + ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isInOrOutColumn(int columnType, boolean function) {
|
||||
if (function) {
|
||||
return (columnType == DatabaseMetaData.functionColumnIn ||
|
||||
columnType == DatabaseMetaData.functionColumnInOut ||
|
||||
columnType == DatabaseMetaData.functionColumnOut);
|
||||
}
|
||||
else {
|
||||
return (columnType == DatabaseMetaData.procedureColumnIn ||
|
||||
columnType == DatabaseMetaData.procedureColumnInOut ||
|
||||
columnType == DatabaseMetaData.procedureColumnOut);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -296,11 +296,11 @@ public abstract class WebApplicationContextUtils {
|
|||
|
||||
Assert.notNull(sources, "'propertySources' must not be null");
|
||||
String name = StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME;
|
||||
if (servletContext != null && sources.contains(name) && sources.get(name) instanceof StubPropertySource) {
|
||||
if (servletContext != null && sources.get(name) instanceof StubPropertySource) {
|
||||
sources.replace(name, new ServletContextPropertySource(name, servletContext));
|
||||
}
|
||||
name = StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME;
|
||||
if (servletConfig != null && sources.contains(name) && sources.get(name) instanceof StubPropertySource) {
|
||||
if (servletConfig != null && sources.get(name) instanceof StubPropertySource) {
|
||||
sources.replace(name, new ServletConfigPropertySource(name, servletConfig));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.web.reactive.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -29,6 +28,7 @@ import org.springframework.web.cors.CorsConfiguration;
|
|||
* @author Sebastien Deleuze
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 5.0
|
||||
* @see CorsConfiguration
|
||||
* @see CorsRegistry
|
||||
*/
|
||||
public class CorsRegistration {
|
||||
|
|
@ -40,6 +40,7 @@ public class CorsRegistration {
|
|||
|
||||
public CorsRegistration(String pathPattern) {
|
||||
this.pathPattern = pathPattern;
|
||||
// Same implicit default values as the @CrossOrigin annotation + allows simple methods
|
||||
this.config = new CorsConfiguration().applyPermitDefaultValues();
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +52,7 @@ public class CorsRegistration {
|
|||
* also set in which case {@code originPatterns} is used instead.
|
||||
*/
|
||||
public CorsRegistration allowedOrigins(String... origins) {
|
||||
this.config.setAllowedOrigins(new ArrayList<>(Arrays.asList(origins)));
|
||||
this.config.setAllowedOrigins(Arrays.asList(origins));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +75,7 @@ public class CorsRegistration {
|
|||
* are allowed.
|
||||
*/
|
||||
public CorsRegistration allowedMethods(String... methods) {
|
||||
this.config.setAllowedMethods(new ArrayList<>(Arrays.asList(methods)));
|
||||
this.config.setAllowedMethods(Arrays.asList(methods));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +89,7 @@ public class CorsRegistration {
|
|||
* <p>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 {
|
|||
* <p>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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
* <p>Exact path mapping URIs (such as {@code "/admin"}) are supported as
|
||||
* well as Ant-style path patterns (such as {@code "/admin/**"}).
|
||||
*
|
||||
* <p>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<String, CorsConfiguration> getCorsConfigurations() {
|
||||
Map<String, CorsConfiguration> configs = new LinkedHashMap<>(this.registrations.size());
|
||||
for (CorsRegistration registration : this.registrations) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -169,7 +169,7 @@ class ControllerMethodResolver {
|
|||
boolean requestMappingMethod = !readers.isEmpty() && supportDataBinding;
|
||||
|
||||
// Annotation-based...
|
||||
List<HandlerMethodArgumentResolver> result = new ArrayList<>();
|
||||
List<HandlerMethodArgumentResolver> result = new ArrayList<>(30);
|
||||
result.add(new RequestParamMethodArgumentResolver(beanFactory, adapterRegistry, false));
|
||||
result.add(new RequestParamMapMethodArgumentResolver(adapterRegistry));
|
||||
result.add(new PathVariableMethodArgumentResolver(beanFactory, adapterRegistry));
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -38,7 +38,6 @@ import org.springframework.web.server.ServerWebInputException;
|
|||
*/
|
||||
public class RequestAttributeMethodArgumentResolver extends AbstractNamedValueSyncArgumentResolver {
|
||||
|
||||
|
||||
/**
|
||||
* Create a new {@link RequestAttributeMethodArgumentResolver} instance.
|
||||
* @param factory a bean factory to use for resolving {@code ${...}}
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ public class CorsRegistration {
|
|||
|
||||
/**
|
||||
* Set the HTTP methods to allow, e.g. {@code "GET"}, {@code "POST"}, etc.
|
||||
* The special value {@code "*"} allows all methods.
|
||||
* <p>By default "simple" methods, i.e. {@code GET}, {@code HEAD}, and
|
||||
* {@code POST} are allowed.
|
||||
* <p>The special value {@code "*"} allows all methods.
|
||||
* <p>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.
|
||||
* <p>The special value {@code "*"} may be used to allow all headers.
|
||||
* <p>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.
|
||||
|
|
|
|||
|
|
@ -39,10 +39,8 @@ public class CorsRegistry {
|
|||
|
||||
/**
|
||||
* Enable cross-origin request handling for the specified path pattern.
|
||||
*
|
||||
* <p>Exact path mapping URIs (such as {@code "/admin"}) are supported as
|
||||
* well as Ant-style path patterns (such as {@code "/admin/**"}).
|
||||
*
|
||||
* <p>By default, the {@code CorsConfiguration} for this mapping is
|
||||
* initialized with default values as described in
|
||||
* {@link CorsConfiguration#applyPermitDefaultValues()}.
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
|||
|
||||
private List<HttpMessageConverter<?>> messageConverters;
|
||||
|
||||
private List<Object> requestResponseBodyAdvice = new ArrayList<>();
|
||||
private final List<Object> requestResponseBodyAdvice = new ArrayList<>();
|
||||
|
||||
@Nullable
|
||||
private WebBindingInitializer webBindingInitializer;
|
||||
|
|
@ -643,7 +643,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
|||
* and custom resolvers provided via {@link #setCustomArgumentResolvers}.
|
||||
*/
|
||||
private List<HandlerMethodArgumentResolver> getDefaultArgumentResolvers() {
|
||||
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>();
|
||||
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>(30);
|
||||
|
||||
// Annotation-based argument resolution
|
||||
resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), false));
|
||||
|
|
@ -690,7 +690,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
|||
* methods including built-in and custom resolvers.
|
||||
*/
|
||||
private List<HandlerMethodArgumentResolver> getDefaultInitBinderArgumentResolvers() {
|
||||
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>();
|
||||
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>(20);
|
||||
|
||||
// Annotation-based argument resolution
|
||||
resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), false));
|
||||
|
|
@ -723,7 +723,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
|||
* custom handlers provided via {@link #setReturnValueHandlers}.
|
||||
*/
|
||||
private List<HandlerMethodReturnValueHandler> getDefaultReturnValueHandlers() {
|
||||
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<>();
|
||||
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<>(20);
|
||||
|
||||
// Single-purpose return value types
|
||||
handlers.add(new ModelAndViewMethodReturnValueHandler());
|
||||
|
|
|
|||
Loading…
Reference in New Issue