mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge branch '3.0.x' into 3.1.x
Closes gh-38225
This commit is contained in:
commit
3560a13d57
@ -156,22 +156,20 @@ public class Neo4jAutoConfiguration {
|
|||||||
|
|
||||||
private TrustStrategy createTrustStrategy(Neo4jProperties.Security securityProperties, String propertyName,
|
private TrustStrategy createTrustStrategy(Neo4jProperties.Security securityProperties, String propertyName,
|
||||||
Security.TrustStrategy strategy) {
|
Security.TrustStrategy strategy) {
|
||||||
switch (strategy) {
|
return switch (strategy) {
|
||||||
case TRUST_ALL_CERTIFICATES:
|
case TRUST_ALL_CERTIFICATES -> TrustStrategy.trustAllCertificates();
|
||||||
return TrustStrategy.trustAllCertificates();
|
case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES -> TrustStrategy.trustSystemCertificates();
|
||||||
case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES:
|
case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES -> {
|
||||||
return TrustStrategy.trustSystemCertificates();
|
|
||||||
case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES:
|
|
||||||
File certFile = securityProperties.getCertFile();
|
File certFile = securityProperties.getCertFile();
|
||||||
if (certFile == null || !certFile.isFile()) {
|
if (certFile == null || !certFile.isFile()) {
|
||||||
throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(),
|
throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(),
|
||||||
"Configured trust strategy requires a certificate file.");
|
"Configured trust strategy requires a certificate file.");
|
||||||
}
|
}
|
||||||
return TrustStrategy.trustCustomCertificateSignedBy(certFile);
|
yield TrustStrategy.trustCustomCertificateSignedBy(certFile);
|
||||||
default:
|
}
|
||||||
throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(),
|
default -> throw new InvalidConfigurationPropertyValueException(propertyName, strategy.name(),
|
||||||
"Unknown strategy.");
|
"Unknown strategy.");
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,12 +27,12 @@ public class MyReadinessStateExporter {
|
|||||||
@EventListener
|
@EventListener
|
||||||
public void onStateChange(AvailabilityChangeEvent<ReadinessState> event) {
|
public void onStateChange(AvailabilityChangeEvent<ReadinessState> event) {
|
||||||
switch (event.getState()) {
|
switch (event.getState()) {
|
||||||
case ACCEPTING_TRAFFIC:
|
case ACCEPTING_TRAFFIC -> {
|
||||||
// create file /tmp/healthy
|
// create file /tmp/healthy
|
||||||
break;
|
}
|
||||||
case REFUSING_TRAFFIC:
|
case REFUSING_TRAFFIC -> {
|
||||||
// remove file /tmp/healthy
|
// remove file /tmp/healthy
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,19 +69,20 @@ public class FilterAnnotations implements Iterable<TypeFilter> {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private TypeFilter createTypeFilter(FilterType filterType, Class<?> filterClass) {
|
private TypeFilter createTypeFilter(FilterType filterType, Class<?> filterClass) {
|
||||||
switch (filterType) {
|
return switch (filterType) {
|
||||||
case ANNOTATION:
|
case ANNOTATION -> {
|
||||||
Assert.isAssignable(Annotation.class, filterClass,
|
Assert.isAssignable(Annotation.class, filterClass,
|
||||||
"An error occurred while processing an ANNOTATION type filter: ");
|
"An error occurred while processing an ANNOTATION type filter: ");
|
||||||
return new AnnotationTypeFilter((Class<Annotation>) filterClass);
|
yield new AnnotationTypeFilter((Class<Annotation>) filterClass);
|
||||||
case ASSIGNABLE_TYPE:
|
}
|
||||||
return new AssignableTypeFilter(filterClass);
|
case ASSIGNABLE_TYPE -> new AssignableTypeFilter(filterClass);
|
||||||
case CUSTOM:
|
case CUSTOM -> {
|
||||||
Assert.isAssignable(TypeFilter.class, filterClass,
|
Assert.isAssignable(TypeFilter.class, filterClass,
|
||||||
"An error occurred while processing a CUSTOM type filter: ");
|
"An error occurred while processing a CUSTOM type filter: ");
|
||||||
return BeanUtils.instantiateClass(filterClass, TypeFilter.class);
|
yield BeanUtils.instantiateClass(filterClass, TypeFilter.class);
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Filter type not supported with Class value: " + filterType);
|
default -> throw new IllegalArgumentException("Filter type not supported with Class value: " + filterType);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private TypeFilter createTypeFilter(FilterType filterType, String pattern) {
|
private TypeFilter createTypeFilter(FilterType filterType, String pattern) {
|
||||||
|
Loading…
Reference in New Issue
Block a user