Skip to content

Commit d59b385

Browse files
committed
Merge branch '3.1.x'
Closes gh-38226
2 parents 0621288 + 3560a13 commit d59b385

File tree

3 files changed

+23
-24
lines changed
  • spring-boot-project

3 files changed

+23
-24
lines changed

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

+9-11
Original file line numberDiff line numberDiff line change
@@ -163,22 +163,20 @@ private Config.TrustStrategy mapTrustStrategy(Neo4jProperties.Security securityP
163163

164164
private TrustStrategy createTrustStrategy(Neo4jProperties.Security securityProperties, String propertyName,
165165
Security.TrustStrategy strategy) {
166-
switch (strategy) {
167-
case TRUST_ALL_CERTIFICATES:
168-
return TrustStrategy.trustAllCertificates();
169-
case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES:
170-
return TrustStrategy.trustSystemCertificates();
171-
case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES:
166+
return switch (strategy) {
167+
case TRUST_ALL_CERTIFICATES -> TrustStrategy.trustAllCertificates();
168+
case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES -> TrustStrategy.trustSystemCertificates();
169+
case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES -> {
172170
File certFile = securityProperties.getCertFile();
173171
if (certFile == null || !certFile.isFile()) {
174172
throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(),
175173
"Configured trust strategy requires a certificate file.");
176174
}
177-
return TrustStrategy.trustCustomCertificateSignedBy(certFile);
178-
default:
179-
throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(),
180-
"Unknown strategy.");
181-
}
175+
yield TrustStrategy.trustCustomCertificateSignedBy(certFile);
176+
}
177+
default -> throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(),
178+
"Unknown strategy.");
179+
};
182180
}
183181

184182
/**

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ public class MyReadinessStateExporter {
2727
@EventListener
2828
public void onStateChange(AvailabilityChangeEvent<ReadinessState> event) {
2929
switch (event.getState()) {
30-
case ACCEPTING_TRAFFIC:
30+
case ACCEPTING_TRAFFIC -> {
3131
// create file /tmp/healthy
32-
break;
33-
case REFUSING_TRAFFIC:
32+
}
33+
case REFUSING_TRAFFIC -> {
3434
// remove file /tmp/healthy
35-
break;
35+
}
3636
}
3737
}
3838

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

+10-9
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,20 @@ private List<TypeFilter> createTypeFilters(Filter[] filters) {
6969

7070
@SuppressWarnings("unchecked")
7171
private TypeFilter createTypeFilter(FilterType filterType, Class<?> filterClass) {
72-
switch (filterType) {
73-
case ANNOTATION:
72+
return switch (filterType) {
73+
case ANNOTATION -> {
7474
Assert.isAssignable(Annotation.class, filterClass,
7575
"An error occurred while processing an ANNOTATION type filter: ");
76-
return new AnnotationTypeFilter((Class<Annotation>) filterClass);
77-
case ASSIGNABLE_TYPE:
78-
return new AssignableTypeFilter(filterClass);
79-
case CUSTOM:
76+
yield new AnnotationTypeFilter((Class<Annotation>) filterClass);
77+
}
78+
case ASSIGNABLE_TYPE -> new AssignableTypeFilter(filterClass);
79+
case CUSTOM -> {
8080
Assert.isAssignable(TypeFilter.class, filterClass,
8181
"An error occurred while processing a CUSTOM type filter: ");
82-
return BeanUtils.instantiateClass(filterClass, TypeFilter.class);
83-
}
84-
throw new IllegalArgumentException("Filter type not supported with Class value: " + filterType);
82+
yield BeanUtils.instantiateClass(filterClass, TypeFilter.class);
83+
}
84+
default -> throw new IllegalArgumentException("Filter type not supported with Class value: " + filterType);
85+
};
8586
}
8687

8788
private TypeFilter createTypeFilter(FilterType filterType, String pattern) {

0 commit comments

Comments
 (0)