Merge branch '2.6.x' into 2.7.x

Closes gh-31525
This commit is contained in:
Andy Wilkinson
2022-06-24 13:05:06 +01:00
29 changed files with 411 additions and 410 deletions

View File

@@ -49,13 +49,13 @@ public class BatchDataSourceInitializer extends org.springframework.boot.jdbc.Ab
protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() {
DatabaseInitializationMode mode = this.jdbcProperties.getInitializeSchema();
switch (mode) {
case ALWAYS:
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
case EMBEDDED:
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
case NEVER:
default:
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
case ALWAYS:
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
case EMBEDDED:
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
case NEVER:
default:
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 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.
@@ -100,12 +100,12 @@ class OnWebApplicationCondition extends FilteringSpringBootCondition {
private ConditionOutcome isWebApplication(ConditionContext context, AnnotatedTypeMetadata metadata,
boolean required) {
switch (deduceType(metadata)) {
case SERVLET:
return isServletWebApplication(context);
case REACTIVE:
return isReactiveWebApplication(context);
default:
return isAnyWebApplication(context, required);
case SERVLET:
return isServletWebApplication(context);
case REACTIVE:
return isReactiveWebApplication(context);
default:
return isAnyWebApplication(context, required);
}
}

View File

@@ -47,13 +47,13 @@ public class IntegrationDataSourceInitializer extends org.springframework.boot.j
protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() {
DatabaseInitializationMode mode = this.properties.getInitializeSchema();
switch (mode) {
case ALWAYS:
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
case EMBEDDED:
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
case NEVER:
default:
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
case ALWAYS:
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
case EMBEDDED:
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
case NEVER:
default:
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
}
}

View File

@@ -315,17 +315,17 @@ public class JacksonAutoConfiguration {
if (strategy != null) {
builder.postConfigurer((objectMapper) -> {
switch (strategy) {
case USE_PROPERTIES_BASED:
objectMapper.setConstructorDetector(ConstructorDetector.USE_PROPERTIES_BASED);
break;
case USE_DELEGATING:
objectMapper.setConstructorDetector(ConstructorDetector.USE_DELEGATING);
break;
case EXPLICIT_ONLY:
objectMapper.setConstructorDetector(ConstructorDetector.EXPLICIT_ONLY);
break;
default:
objectMapper.setConstructorDetector(ConstructorDetector.DEFAULT);
case USE_PROPERTIES_BASED:
objectMapper.setConstructorDetector(ConstructorDetector.USE_PROPERTIES_BASED);
break;
case USE_DELEGATING:
objectMapper.setConstructorDetector(ConstructorDetector.USE_DELEGATING);
break;
case EXPLICIT_ONLY:
objectMapper.setConstructorDetector(ConstructorDetector.EXPLICIT_ONLY);
break;
default:
objectMapper.setConstructorDetector(ConstructorDetector.DEFAULT);
}
});
}

View File

@@ -188,19 +188,20 @@ public class Neo4jAutoConfiguration {
private TrustStrategy createTrustStrategy(Neo4jProperties.Security securityProperties, String propertyName,
Security.TrustStrategy strategy) {
switch (strategy) {
case TRUST_ALL_CERTIFICATES:
return TrustStrategy.trustAllCertificates();
case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES:
return TrustStrategy.trustSystemCertificates();
case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES:
File certFile = securityProperties.getCertFile();
if (certFile == null || !certFile.isFile()) {
case TRUST_ALL_CERTIFICATES:
return TrustStrategy.trustAllCertificates();
case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES:
return TrustStrategy.trustSystemCertificates();
case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES:
File certFile = securityProperties.getCertFile();
if (certFile == null || !certFile.isFile()) {
throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(),
"Configured trust strategy requires a certificate file.");
}
return TrustStrategy.trustCustomCertificateSignedBy(certFile);
default:
throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(),
"Configured trust strategy requires a certificate file.");
}
return TrustStrategy.trustCustomCertificateSignedBy(certFile);
default:
throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(), "Unknown strategy.");
"Unknown strategy.");
}
}

View File

@@ -53,13 +53,13 @@ public class QuartzDataSourceInitializer extends org.springframework.boot.jdbc.A
protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() {
DatabaseInitializationMode mode = this.properties.getJdbc().getInitializeSchema();
switch (mode) {
case ALWAYS:
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
case EMBEDDED:
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
case NEVER:
default:
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
case ALWAYS:
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
case EMBEDDED:
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
case NEVER:
default:
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
}
}

View File

@@ -47,13 +47,13 @@ public class JdbcSessionDataSourceInitializer extends org.springframework.boot.j
protected org.springframework.boot.jdbc.DataSourceInitializationMode getMode() {
DatabaseInitializationMode mode = this.properties.getInitializeSchema();
switch (mode) {
case ALWAYS:
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
case EMBEDDED:
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
case NEVER:
default:
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
case ALWAYS:
return org.springframework.boot.jdbc.DataSourceInitializationMode.ALWAYS;
case EMBEDDED:
return org.springframework.boot.jdbc.DataSourceInitializationMode.EMBEDDED;
case NEVER:
default:
return org.springframework.boot.jdbc.DataSourceInitializationMode.NEVER;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@@ -56,10 +56,10 @@ class RedisSessionConfiguration {
@ConditionalOnMissingBean
ConfigureRedisAction configureRedisAction(RedisSessionProperties redisSessionProperties) {
switch (redisSessionProperties.getConfigureAction()) {
case NOTIFY_KEYSPACE_EVENTS:
return new ConfigureNotifyKeyspaceEventsAction();
case NONE:
return ConfigureRedisAction.NO_OP;
case NOTIFY_KEYSPACE_EVENTS:
return new ConfigureNotifyKeyspaceEventsAction();
case NONE:
return ConfigureRedisAction.NO_OP;
}
throw new IllegalStateException(
"Unsupported redis configure action '" + redisSessionProperties.getConfigureAction() + "'.");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 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.
@@ -77,10 +77,10 @@ final class SessionStoreMappings {
String getConfiguration(WebApplicationType webApplicationType) {
switch (webApplicationType) {
case SERVLET:
return getName(this.servletConfiguration);
case REACTIVE:
return getName(this.reactiveConfiguration);
case SERVLET:
return getName(this.servletConfiguration);
case REACTIVE:
return getName(this.reactiveConfiguration);
}
return null;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@@ -173,12 +173,12 @@ public class DefaultErrorWebExceptionHandler extends AbstractErrorWebExceptionHa
*/
protected boolean isIncludeStackTrace(ServerRequest request, MediaType produces) {
switch (this.errorProperties.getIncludeStacktrace()) {
case ALWAYS:
return true;
case ON_PARAM:
return isTraceEnabled(request);
default:
return false;
case ALWAYS:
return true;
case ON_PARAM:
return isTraceEnabled(request);
default:
return false;
}
}
@@ -190,12 +190,12 @@ public class DefaultErrorWebExceptionHandler extends AbstractErrorWebExceptionHa
*/
protected boolean isIncludeMessage(ServerRequest request, MediaType produces) {
switch (this.errorProperties.getIncludeMessage()) {
case ALWAYS:
return true;
case ON_PARAM:
return isMessageEnabled(request);
default:
return false;
case ALWAYS:
return true;
case ON_PARAM:
return isMessageEnabled(request);
default:
return false;
}
}
@@ -207,12 +207,12 @@ public class DefaultErrorWebExceptionHandler extends AbstractErrorWebExceptionHa
*/
protected boolean isIncludeBindingErrors(ServerRequest request, MediaType produces) {
switch (this.errorProperties.getIncludeBindingErrors()) {
case ALWAYS:
return true;
case ON_PARAM:
return isBindingErrorsEnabled(request);
default:
return false;
case ALWAYS:
return true;
case ON_PARAM:
return isBindingErrorsEnabled(request);
default:
return false;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@@ -132,12 +132,12 @@ public class BasicErrorController extends AbstractErrorController {
*/
protected boolean isIncludeStackTrace(HttpServletRequest request, MediaType produces) {
switch (getErrorProperties().getIncludeStacktrace()) {
case ALWAYS:
return true;
case ON_PARAM:
return getTraceParameter(request);
default:
return false;
case ALWAYS:
return true;
case ON_PARAM:
return getTraceParameter(request);
default:
return false;
}
}
@@ -149,12 +149,12 @@ public class BasicErrorController extends AbstractErrorController {
*/
protected boolean isIncludeMessage(HttpServletRequest request, MediaType produces) {
switch (getErrorProperties().getIncludeMessage()) {
case ALWAYS:
return true;
case ON_PARAM:
return getMessageParameter(request);
default:
return false;
case ALWAYS:
return true;
case ON_PARAM:
return getMessageParameter(request);
default:
return false;
}
}
@@ -166,12 +166,12 @@ public class BasicErrorController extends AbstractErrorController {
*/
protected boolean isIncludeBindingErrors(HttpServletRequest request, MediaType produces) {
switch (getErrorProperties().getIncludeBindingErrors()) {
case ALWAYS:
return true;
case ON_PARAM:
return getErrorsParameter(request);
default:
return false;
case ALWAYS:
return true;
case ON_PARAM:
return getErrorsParameter(request);
default:
return false;
}
}