Browse Source

Merge branch '3.1.x'

pull/38153/head
Moritz Halbritter 2 years ago
parent
commit
20edbb402f
  1. 7
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidator.java
  2. 9
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfiguration.java
  3. 2
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/CompositePropagationFactoryTests.java
  4. 6
      spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/DevToolsR2dbcAutoConfigurationTests.java
  5. 17
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/json/JsonStream.java
  6. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java
  7. 9
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataResource.java

7
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidator.java

@ -24,9 +24,8 @@ import java.security.Signature; @@ -24,9 +24,8 @@ import java.security.Signature;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
import reactor.core.publisher.Mono;
@ -44,7 +43,7 @@ class ReactiveTokenValidator { @@ -44,7 +43,7 @@ class ReactiveTokenValidator {
private final ReactiveCloudFoundrySecurityService securityService;
private volatile ConcurrentMap<String, String> cachedTokenKeys = new ConcurrentHashMap<>();
private volatile Map<String, String> cachedTokenKeys = Collections.emptyMap();
ReactiveTokenValidator(ReactiveCloudFoundrySecurityService securityService) {
this.securityService = securityService;
@ -92,7 +91,7 @@ class ReactiveTokenValidator { @@ -92,7 +91,7 @@ class ReactiveTokenValidator {
}
private void cacheTokenKeys(Map<String, String> tokenKeys) {
this.cachedTokenKeys = new ConcurrentHashMap<>(tokenKeys);
this.cachedTokenKeys = Map.copyOf(tokenKeys);
}
private boolean hasValidSignature(Token token, String key) {

9
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfiguration.java

@ -67,7 +67,6 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur @@ -67,7 +67,6 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.security.web.util.matcher.OrRequestMatcher;
import org.springframework.security.web.util.matcher.RequestMatcher;
import org.springframework.util.CollectionUtils;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.servlet.DispatcherServlet;
@ -125,8 +124,8 @@ public class CloudFoundryActuatorAutoConfiguration { @@ -125,8 +124,8 @@ public class CloudFoundryActuatorAutoConfiguration {
allEndpoints.addAll(webEndpoints);
allEndpoints.addAll(servletEndpointsSupplier.getEndpoints());
allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints());
return new CloudFoundryWebEndpointServletHandlerMapping(new EndpointMapping("/cloudfoundryapplication"),
webEndpoints, endpointMediaTypes, getCorsConfiguration(), securityInterceptor, allEndpoints);
return new CloudFoundryWebEndpointServletHandlerMapping(new EndpointMapping(BASE_PATH), webEndpoints,
endpointMediaTypes, getCorsConfiguration(), securityInterceptor, allEndpoints);
}
private CloudFoundrySecurityInterceptor getSecurityInterceptor(RestTemplateBuilder restTemplateBuilder,
@ -189,9 +188,7 @@ public class CloudFoundryActuatorAutoConfiguration { @@ -189,9 +188,7 @@ public class CloudFoundryActuatorAutoConfiguration {
.forEach((path) -> requestMatchers.add(new AntPathRequestMatcher(path + "/**")));
requestMatchers.add(new AntPathRequestMatcher(BASE_PATH));
requestMatchers.add(new AntPathRequestMatcher(BASE_PATH + "/"));
if (!CollectionUtils.isEmpty(requestMatchers)) {
web.ignoring().requestMatchers(new OrRequestMatcher(requestMatchers));
}
web.ignoring().requestMatchers(new OrRequestMatcher(requestMatchers));
}
}

2
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/CompositePropagationFactoryTests.java

@ -65,7 +65,7 @@ class CompositePropagationFactoryTests { @@ -65,7 +65,7 @@ class CompositePropagationFactoryTests {
}
@Nested
static class CompostePropagationTests {
class CompositePropagationTests {
@Test
void keys() {

6
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/DevToolsR2dbcAutoConfigurationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@ -152,12 +152,12 @@ class DevToolsR2dbcAutoConfigurationTests { @@ -152,12 +152,12 @@ class DevToolsR2dbcAutoConfigurationTests {
@Nested
@ClassPathExclusions("r2dbc-pool*.jar")
static class Embedded extends Common {
class Embedded extends Common {
}
@Nested
static class Pooled extends Common {
class Pooled extends Common {
}

17
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/json/JsonStream.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 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.
@ -64,13 +64,14 @@ public class JsonStream { @@ -64,13 +64,14 @@ public class JsonStream {
*/
public <T> void get(InputStream content, Class<T> type, Consumer<T> consumer) throws IOException {
JsonFactory jsonFactory = this.objectMapper.getFactory();
JsonParser parser = jsonFactory.createParser(content);
while (!parser.isClosed()) {
JsonToken token = parser.nextToken();
if (token != null && token != JsonToken.END_OBJECT) {
T node = read(parser, type);
if (node != null) {
consumer.accept(node);
try (JsonParser parser = jsonFactory.createParser(content)) {
while (!parser.isClosed()) {
JsonToken token = parser.nextToken();
if (token != null && token != JsonToken.END_OBJECT) {
T node = read(parser, type);
if (node != null) {
consumer.accept(node);
}
}
}
}

2
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java

@ -265,7 +265,7 @@ class BeanDefinitionLoader { @@ -265,7 +265,7 @@ class BeanDefinitionLoader {
.getResources(ClassUtils.convertClassNameToResourcePath(source.toString()) + "/*.class");
for (Resource resource : resources) {
String className = StringUtils.stripFilenameExtension(resource.getFilename());
load(Class.forName(source.toString() + "." + className));
load(Class.forName(source + "." + className));
break;
}
}

9
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataResource.java

@ -106,7 +106,7 @@ public class StandardConfigDataResource extends ConfigDataResource { @@ -106,7 +106,7 @@ public class StandardConfigDataResource extends ConfigDataResource {
}
private boolean isSameFile(File ours, File other) {
return (ours != null) && (other != null) && ours.equals(other);
return (ours != null) && ours.equals(other);
}
@Override
@ -119,9 +119,10 @@ public class StandardConfigDataResource extends ConfigDataResource { @@ -119,9 +119,10 @@ public class StandardConfigDataResource extends ConfigDataResource {
public String toString() {
if (this.resource instanceof FileSystemResource || this.resource instanceof FileUrlResource) {
try {
return "file [" + this.resource.getFile().toString() + "]";
return "file [" + this.resource.getFile() + "]";
}
catch (IOException ex) {
// Ignore
}
}
return this.resource.toString();
@ -131,11 +132,11 @@ public class StandardConfigDataResource extends ConfigDataResource { @@ -131,11 +132,11 @@ public class StandardConfigDataResource extends ConfigDataResource {
try {
if (resource instanceof ClassPathResource || resource instanceof FileSystemResource
|| resource instanceof FileUrlResource) {
File file = resource.getFile();
return (file != null) ? file.getAbsoluteFile() : null;
return resource.getFile().getAbsoluteFile();
}
}
catch (IOException ex) {
// Ignore
}
return null;
}

Loading…
Cancel
Save