Browse Source

Merge branch '3.1.x'

Closes gh-38226
pull/38263/head
Moritz Halbritter 2 years ago
parent
commit
d59b385304
  1. 20
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/neo4j/Neo4jAutoConfiguration.java
  2. 8
      spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/springapplication/applicationavailability/managing/MyReadinessStateExporter.java
  3. 19
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/FilterAnnotations.java

20
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/neo4j/Neo4jAutoConfiguration.java

@ -163,22 +163,20 @@ public class Neo4jAutoConfiguration { @@ -163,22 +163,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:
return switch (strategy) {
case TRUST_ALL_CERTIFICATES -> TrustStrategy.trustAllCertificates();
case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES -> 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(),
"Unknown strategy.");
}
yield TrustStrategy.trustCustomCertificateSignedBy(certFile);
}
default -> throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(),
"Unknown strategy.");
};
}
/**

8
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/springapplication/applicationavailability/managing/MyReadinessStateExporter.java

@ -27,12 +27,12 @@ public class MyReadinessStateExporter { @@ -27,12 +27,12 @@ public class MyReadinessStateExporter {
@EventListener
public void onStateChange(AvailabilityChangeEvent<ReadinessState> event) {
switch (event.getState()) {
case ACCEPTING_TRAFFIC:
case ACCEPTING_TRAFFIC -> {
// create file /tmp/healthy
break;
case REFUSING_TRAFFIC:
}
case REFUSING_TRAFFIC -> {
// remove file /tmp/healthy
break;
}
}
}

19
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/FilterAnnotations.java

@ -69,19 +69,20 @@ public class FilterAnnotations implements Iterable<TypeFilter> { @@ -69,19 +69,20 @@ public class FilterAnnotations implements Iterable<TypeFilter> {
@SuppressWarnings("unchecked")
private TypeFilter createTypeFilter(FilterType filterType, Class<?> filterClass) {
switch (filterType) {
case ANNOTATION:
return switch (filterType) {
case ANNOTATION -> {
Assert.isAssignable(Annotation.class, filterClass,
"An error occurred while processing an ANNOTATION type filter: ");
return new AnnotationTypeFilter((Class<Annotation>) filterClass);
case ASSIGNABLE_TYPE:
return new AssignableTypeFilter(filterClass);
case CUSTOM:
yield new AnnotationTypeFilter((Class<Annotation>) filterClass);
}
case ASSIGNABLE_TYPE -> new AssignableTypeFilter(filterClass);
case CUSTOM -> {
Assert.isAssignable(TypeFilter.class, filterClass,
"An error occurred while processing a CUSTOM type filter: ");
return BeanUtils.instantiateClass(filterClass, TypeFilter.class);
}
throw new IllegalArgumentException("Filter type not supported with Class value: " + filterType);
yield BeanUtils.instantiateClass(filterClass, TypeFilter.class);
}
default -> throw new IllegalArgumentException("Filter type not supported with Class value: " + filterType);
};
}
private TypeFilter createTypeFilter(FilterType filterType, String pattern) {

Loading…
Cancel
Save